I have seen a few questions about this. Eg:
Superfluous 'runtimes' folder created in output directory for .NET 5 project
I don't mind these DLL files being there, but I am concerned. This is my runtimes folder structure:
runtimes
win
lib
net7.0
System.Management.dll
net8.0
System.Security.Cryptography.Pkcs.dll
My application is meant for running on a Windows PC, but my concern is this net7.0
reference. In my installer I only check for .NET8 Runtime dependency and not .NET7.
The System.Management.dll
is used by Google.Apis.Gmail.v1
:
The System.Security.Cryptography.Pkcs.dll
is used by Mimekit
, but I am not worried about this one:
Concerning the Google.Apis.Gmail.v1
NuGet package it states:
Google APIs Client Library for working with Gmail v1.
Supported Platforms: - .NET Framework 4.6.2+ - .NET Standard 2.0 - .NET 6.0+
So, back to my concern … my installer only checks for .NET8 runtime as that is my target platform. Should I be concerned about this reference to .NET7 runtime in the runtimes sub-folder?
Can you please provide a minimal reproducible example?
I don't know how to share it. But it is easily reproducible (at-least for me):
Google.Apis.Gmail.v1
NuGet package.Navigate using File Explorer to here (relative to your root ofcourse):
...\ConsoleApp1\ConsoleApp1\bin\Debug\net8.0\runtimes\win\lib\net7.0
The explanation about why this has been happening is explained in this GutHub discussion:
https://github.com/googleapis/google-api-dotnet-client/issues/2722
To summarize:
I believe it's showing up as net7.0 because we're currently depending on version 7.0.2 of
System.Management
, and that only targeted as far as net7.0 - but as net8.0 is compatible with net7.0, it will still load that at execution time.If you want to move to the net8.0-targeted version, you can manually add a dependency on System.Management 8.0 yourself - then
System.Management.dll
will be inruntimes/win/lib/net8.0/System.Management.dll
. If that makes your installer simpler, it'll do no harm.
The solution I settled on following was:
I would encourage you to use
dotnet publish
for this instead. The whole point ofdotnet publish
is to prepare the application for publication, which is what your installer is presumably there for.
In the coming months this dependencies will be updated in Google.Apis.Gmail.v1
.