Closed tobuto closed 3 years ago
try v13.14.4
Same result unfortunately:
dotnet --roll-forward-on-no-candidate-fx 2 "/Users/tobuto/.nuget/packages/nswag.msbuild/13.14.4/build/../tools/NetCore31//dotnet-nswag.dll" openapi2csclient /className:openapiClient /namespace:OpenApi /input:"/Users/tobuto/projects/OpenApi/OpenApi/openapi.json" /output:"obj/openapiClient.cs"
/Users/tobuto/.nuget/packages/nswag.apidescription.client/13.14.4/build/NSwag.ApiDescription.Client.targets(28,5): error : Failed to load /usr/local/share/dotnet/shared/Microsoft.NETCore.App/5.0.12/libhostpolicy.dylib, error: dlopen(/usr/local/share/dotnet/shared/Microsoft.NETCore.App/5.0.12/libhostpolicy.dylib, 0x0001): tried: '/usr/local/share/dotnet/shared/Microsoft.NETCore.App/5.0.12/libhostpolicy.dylib' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64e')), '/usr/local/lib/libhostpolicy.dylib' (no such file), '/usr/lib/libhostpolicy.dylib' (no such file) [/Users/tobuto/projects/OpenApi/OpenApi/OpenApi.csproj]
/Users/tobuto/.nuget/packages/nswag.apidescription.client/13.14.4/build/NSwag.ApiDescription.Client.targets(28,5): error : An error occurred while loading required library libhostpolicy.dylib from [/usr/local/share/dotnet/shared/Microsoft.NETCore.App/5.0.12] [/Users/tobuto/projects/OpenApi/OpenApi/OpenApi.csproj]
/Users/tobuto/.nuget/packages/nswag.apidescription.client/13.14.4/build/NSwag.ApiDescription.Client.targets(28,5): error MSB3073: The command "dotnet --roll-forward-on-no-candidate-fx 2 "/Users/tobuto/.nuget/packages/nswag.msbuild/13.14.4/build/../tools/NetCore31//dotnet-nswag.dll" openapi2csclient /className:openapiClient /namespace:OpenApi /input:"/Users/tobuto/projects/OpenApi/OpenApi/openapi.json" /output:"obj/openapiClient.cs" " exited with code 130. [/Users/tobuto/projects/OpenApi/OpenApi/OpenApi.csproj]
Seems to always use .NET Core 3.1, no idea how to make this conditional/dependent on the currently used framework: https://github.com/RicoSuter/NSwag/blob/master/src/NSwag.ApiDescription.Client/NSwag.ApiDescription.Client.targets#L6
@pranavkm can you help here?
This resolved the issue for me locally:
<PropertyGroup>
<_NSwagCommand>$(NSwagExe)</_NSwagCommand>
<_NSwagCommand
Condition="'$(MSBuildRuntimeType)' == 'Core'">dotnet --roll-forward-on-no-candidate-fx 2 "$(NSwagDir_Core31)/dotnet-nswag.dll"</_NSwagCommand>
<_NSwagCommand
Condition="'$(TargetFramework)' == 'net6.0'">dotnet --roll-forward-on-no-candidate-fx 2 "$(NSwagDir_Net60)/dotnet-nswag.dll"</_NSwagCommand>
</PropertyGroup>
PR: https://github.com/RicoSuter/NSwag/pull/3745 Do you think this should fix this?
Looks good! Thank you for the quick turnaround :)
I'm currently developing an application on a silicon mac, and hence am using .NET 6 for native ARM support. It seems like because in
NSwag.ApiDescription.Client.targets
$(NSwagDir_Core31)
is used when the runtime is core, it fails. Manually changing this to$(NSwagDir_Core60)
seems to resolve the issue. Is this something you could include in the file? Maybe using$(TargetFramework) == 'net6.0'
, though there might be some better way to approach this.