首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >在ARM Mac上的dotnet swagger tofile与swagger tofile

在ARM Mac上的dotnet swagger tofile与swagger tofile
EN

Stack Overflow用户
提问于 2022-09-26 05:19:26
回答 1查看 145关注 0票数 1

你好,是否有人想知道为什么运行dotnet swagger与通过dotnet tool install在全球安装Swashbuckle.AspNetCore.Cli相比,在苹果硅上不起作用。

对于上下文,我在我的.NET文件中有一个带有PostBuild目标的swagger.json 6 API,以生成一个构建上的swagger.json,如下所示

代码语言:javascript
运行
复制
<Target Name="SwaggerToFile" Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU' AND '$(NCrunch)' != '1'" AfterTargets="AfterBuild">
    <Exec Command="dotnet tool restore" />
    <Exec Command="dotnet swagger tofile --output doc.json $(OutputPath)$(AssemblyName).dll" />
</Target>

在Apple上,此步骤失败,您将得到以下错误消息

代码语言:javascript
运行
复制
 It was not possible to find any compatible framework version
         The framework 'Microsoft.AspNetCore.App', version '5.0.0' (arm64) was not found.
           - The following frameworks were found:
               6.0.5 at [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
         
         You can resolve the problem by installing the specified framework and/or SDK.

就我所知,以上所述并不存在

但是,如果我全局安装Swashbuckle.AspNetCore.Cli,然后将命令更改为swagger tofile --output doc.json $(OutputPath)$(AssemblyName).dll,它就能工作。试图理解为什么这里有区别,如果它是相同的CLI工具在引擎盖下。

我只有.NET 6.0SDK和运行时,我对罗塞塔没有什么花哨。

EN

Stack Overflow用户

发布于 2022-09-26 06:13:05

我使用的是M2 Macbook Pro,我需要将ff添加到我的.zshrc中,这样才能使傲慢的CLI工作。

~/.zshrc

export PATH="$HOME/.dotnet/tools:$PATH"

我不记得具体情况,但这与添加到环境变量的路径有关。在这种情况下,dotnet工具路径应该是$HOME/.dotnet/tools

在进行此更改后,我可以通过swagger tofile ...使用swagger命令

票数 1
EN
查看全部 1 条回答
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/73849858

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档