Why Are There System.*.* Dlls in My Bin Release Directory

Why are there System.*.* dlls in my bin release directory?

This is a .net standard 2.0/net 4.6/4.7.1 issue which was improved in 4.7.2:

"In .NET Framework 4.7.2 we have addresses the known runtime issues
with .NET Standard 2.0. We made changes to the runtime to ensure
that you don’t need additional files deployed along with your .NET Standard library"

So, run Visual Studio 2017 Installer and install .Net Framework 4.7.2 and the Target Pack and target your app as .net 4.7.2.

Prevent Visual studio 2017 from copying almost 100 unnecessary system dlls to output folder for dll project

Prevent Visual studio 2017 from copying almost 100 unnecessary system
dlls to output folder for dll project

Please check if your VS2017 is very old and also check if the framework version of your project targets to 4.6 or 4.7.1.

If so, there is an known issue about this issue.

This is a .net standard 2.0/net 4.6/4.7.1 issue which was improved in 4.7.2. You can check this similar issue.

Suggestion

1) you should first update your VS2017 in case some updates fix it.

2) change the framework version of your project to net framework 4.7.2.(if you do not have net frameowork 4.7.2, you should install it in the VS Installer)

VS2017 Setup project for .NET 4.7.2

What could be causing the netstandard.dll to be included in the
project output?

First, thanks to magicandre1981 for all his help.

You have referenced a net standard nuget packages in your Net Framework 4.7.2 project. And because of the special nature of the package, it needs to refer to netstandard.dll as a runtime environment.

Although Net Frameowork 4.7.2 optimizes the build output file, so netstandard.dll cannot be shown in the project outputpath, but in fact the project will still use it at runtime.

But for the setup project, there is no such feature. Using the netstandard nuget package, all references will be displayed in Detected Dependencies including netstandard.dll.

In addition, Net Standard 2.0 is compatible with Net Frameowork 4.7.2, and you can refer to this document.

How can I use netstandard2 using .net Framework 4.5?

.Net standard 2.0 support works starting with .net framework 4.6.1, but you get a lot of system DLLs next to your app. So use .net 4.8 and not 4.6.x.

The minimum requirement to use .net standard libs is to use Visual Studio 2015 (with the update 3 + a special hotfix), but it is better to use VS2017 or 2019:

If you only need to consume .NET Standard 2.0 libraries in your
projects, you can also do that in Visual Studio 2015. However, you
need NuGet client 3.6 or higher installed.

So your VS2013 is too old.



Related Topics



Leave a reply



Submit