Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

My c# visual studio project generates too much dll files when compilation

Tags:

.net

msbuild

I have a visual studio win forms project that works correctly. When I compile this project to generate the release file I see that I have like 30 dll generated. These dll files are mainly System dll so I think I don't need those files. If I delete this files my app keeps working correctly but I don't know how to say to the visual studio please don't generate those files. Anyone knows how can I configure my project to avoid generating all these files? My output release is the following:

enter image description here

I know that I need some files but not the System ones. This is my properties project:

enter image description here

If I look to the MSBuilder to analyze what is going on I see the following:

enter image description here

enter image description here

I can't see what library is the one. What I am supposed to do right now?

like image 455
Xim123 Avatar asked Jun 18 '19 10:06

Xim123


1 Answers

Welcome to the .NET Standard DLL hell.

You're targeting the full .NET Framework, but you've installed a NuGet package that depends on .NET Standard, which causes MSBuild to pull in facade assemblies from its installation directory in Program Files.

Find the package that (indirectly) depends on .NET Standard, and upgrade or downgrade it to a version that doesn't.

To analyze: create a binlog of your build and open the log file, search for _DependsOnNetStandard. You'll then find libraries who do, and can work up the dependency tree from there.

Some packages claim to support .NET Framework 4.x, but actually only contain a netstandard11 directory in their lib.

like image 58
CodeCaster Avatar answered Oct 25 '22 04:10

CodeCaster