你好,是否有人想知道为什么运行dotnet swagger与通过dotnet tool install在全球安装Swashbuckle.AspNetCore.Cli相比,在苹果硅上不起作用。
对于上下文,我在我的.NET文件中有一个带有PostBuild目标的swagger.json 6 API,以生成一个构建上的swagger.json,如下所示
<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上,此步骤失败,您将得到以下错误消息
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和运行时,我对罗塞塔没有什么花哨。
发布于 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命令
https://stackoverflow.com/questions/73849858
复制相似问题