Hello wondering if anyone has any ideas as to why running dotnet swagger
doesn't work on Apple Silicon compared to installing Swashbuckle.AspNetCore.Cli globally via dotnet tool install
.
For context I have a .NET 6 API with a PostBuild target in my .csproj file to generate a swagger.json on build which looks like what is show below
<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>
On Apple Silicon this step fails and you get the following error message
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.
^ The above doesn't exist as far as I'm aware
However if I install the Swashbuckle.AspNetCore.Cli globally and then change the command to swagger tofile --output doc.json $(OutputPath)$(AssemblyName).dll
it works. Trying to understand why there is a difference here if it's the same CLI tool under the hood.
I only have .NET 6.0 SDKs and Runtimes and am doing nothing fancy with Rosetta.