-
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
dotnet publish should not include static libraries #13985
Comments
I assume this repros with all versions of the SDK, correct? My instinct is that we likely don't want to change this behavior, but do you have any thoughts @wli3? |
@jeffschwMSFT could you help us route to the right person to answer the question? If these files are not runtime asset, they should only be include in targeting pack instead of runtime pack. |
We removed these in .NET 5 RC2. What version is this for? cc @vitek-karas |
Oh that's great. Could you please show me how you did it? I.e. point me at the exact commit that removed them? I was probably looking at the wrong branch during my investigations. Or I did not properly understand how everything is packaged together.
Sorry I forgot to mention. I have observed that static libraries end up in the publish directory with both 3.1.402 and 5.0.100-rc.1.20452.10 SDKs. |
We fixed this in master branch dotnet/runtime#41966, but the port to RC2 was rejected by triage: dotnet/runtime#41986. |
Thanks for the clarification, Vitek. Don't you think that the |
Oh man, I thought that we took that change. You are right we could not safely remove them so late. |
@0xced sorry I don't remember the details anymore. I agree they should not be mentioned anywhere in the runtime pack, but I don't know if my "fix" actually fixes the runtime list. |
I can confirm that the files no longer show up in RuntimeList.xml after the fix. |
On macOS (and maybe also on Linux, I have not tried) five static libraries end up in the publish directory when publishing an executable with
dotnet publish -c Release -r osx-x64
(reproducible with a hello world console app):Those are not required at runtime (only dynamic libraries are used) and should not be included in the publish directory.
As a workaround I have added this in my csproj file:
Ideally this workaround should not be needed and the SDK should be responsible for not publishing the static library files.
Technical details (gathered by analyzing the binary build log with MSBuild Log Viewer, reading and grepping source code in dotnet repositories):
ResolveRuntimePackAssets
MSBuild task.ResolveRuntimePackAssets
MSBuild task reads aRuntimeList.xml
file, apparently from the Microsoft.NETCore.App.Runtime.osx-x64 NuGet package in thedata
directory.RuntimeList.xml
file seems to be created by theGenerateRuntimeListFile
target (dotnet/runtime repository).GenerateRuntimeListFile
target calls theCreateFrameworkListFile
MSBuild task (dotnet/arcade repository) to create theRuntimeList.xml
file.I think that what should be fixed is the
RuntimePackNativeFile
item. It includes everything$(MicrosoftNetCoreAppRuntimePackNativeDir)*.*
but should probably exclude.a
files. I'll let someone at Microsoft more exerienced than me confirm my intuition though.The text was updated successfully, but these errors were encountered: