11

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?

6
  • Why do you care about the number of "generated files"? Why do you not want to include them as build output?
    – Igor
    Jun 18, 2019 at 10:31
  • Those files are not generated but they are copied from their original location to the build location as during compilation. This is to make sure that the application has all the dependencies available when it runs.
    – Chetan
    Jun 18, 2019 at 10:31
  • I need to put some order in the output file. @Igor
    – Xim123
    Jun 18, 2019 at 10:37
  • how can I change this? I don't need all those files @ChetanRanpariya
    – Xim123
    Jun 18, 2019 at 10:37
  • I need to put some order in the output file. ← Why? Not trying to be rude, I genuinely want to understand your use case.
    – Igor
    Jun 18, 2019 at 10:41

1 Answer 1

16

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.

5
  • I just have one nuget package installed which is M2Mqtt. So what you mean is that I should downgrade this package to a version that doesn't depend on .Net Standard? Thank you @CodeCaster
    – Xim123
    Jun 18, 2019 at 10:36
  • You've got more. I see at least iTextSharp and Azure CosmosDB libraries.
    – CodeCaster
    Jun 18, 2019 at 10:39
  • Yes, I thought I had deleted it. Now I have iTextSharp and M2Mqtt how can I know which one it is? @CodeCaster
    – Xim123
    Jun 18, 2019 at 10:46
  • What did you do?
    – CodeCaster
    Jun 18, 2019 at 11:51
  • 1
    I saw in my project file (csproj) which libraries had a reference to netstandard and I deleted those libraries because I didn't even need them (system.buffer and system.vectors or something like this). Those libraries were added when I downloaded a nuget package. You helped a lot Thanks! @CodeCaster
    – Xim123
    Jun 18, 2019 at 12:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.