-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Publishing with win-x64
RID doesn't include runtime-specific Nuget libraries
#10665
Comments
I think we have the same issue with SqlClient dll's and dotnet publish. I actually made an issue on their repo but it probably should be here too. I made a reproduction repo for the issue here: https://github.com/davedx/sqlclient-repro Edit: I narrowed this down some. If you have do dotnet build first without specifying --runtime, then do dotnet publish with --runtime, it doesn't work. But if you specify --runtime when you do the dotnet build then it works correctly. This behaviour is new for us Another edit: I downgraded my repro project to dotnet 2.1 and the behaviour above does not happen. It appears this is because the build command in 2.1 did not do a "restore" automatically? So maybe this isn't a bug but a very subtle breaking change... Final edit: here it is, the breaking change, documented: https://docs.microsoft.com/en-us/dotnet/core/whats-new/dotnet-core-3-0#build-copies-dependencies Seems like a nice quality of life improvement, but for platform specific builds it can cause a lot of pain... |
I just tried to repro this with the .NET 6 SDK. This is what I see. Does that resolve the issue? root@a1e6b08d8845:/app# dotnet publish -r win10-x64
root@a1e6b08d8845:/app# find bin/Debug/net6.0/win10-x64/publish/ | grep Microsoft.Man
bin/Debug/net6.0/win10-x64/publish/Microsoft.Management.Infrastructure.Native.dll
bin/Debug/net6.0/win10-x64/publish/Microsoft.Management.Infrastructure.dll
bin/Debug/net6.0/win10-x64/publish/Microsoft.Management.Infrastructure.Native.Unmanaged.dll
root@a1e6b08d8845:/app# |
I publish with the following command on my Apple arm computer with dotNet arm installed: dotnet publish -c Release --runtime win-x64 --no-self-contained I wasn't able to make it work on a Windows x64 system. There is no runtime folder in the publish folder. |
It is recommended to use portable RIDs, such as For more information, see Using RIDs and .NET SDK uses a smaller RID graph. <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Management.Infrastructure" Version="3.0.0" />
</ItemGroup>
</Project>
|
Steps to reproduce
Reference a Nuget package with runtime-specific libraries.
dotnet publish
dotnet publish -r win10-x64
dotnet publish -r win-x64
No library from the Nuget package is copied to /publish directory.
Expected behavior
dotnet publish -r win-x64
Actual behavior
dotnet publish -r win-x64
succeeds, but the produced program will definitely crash.Environment data
The text was updated successfully, but these errors were encountered: