Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Copy all dependencies from .Net Standard libraries to .Net Framework Console application

Tags:

After consuming .net standard projects in a .net framework(4.6) console application, the dependencies of the .net standard projects are not copied into the output directory. This results in run time error of missing dlls. The "copy local" property is already true for the referenced projects. One possible solution is to add all the dependencies again in the console application, but is not a good idea. Is there a better solution to this?

like image 464
tech-y Avatar asked Jul 03 '18 12:07

tech-y


1 Answers

After going through an article by Scott Hanselman, below solution worked like a charm.

Add below line in the first "PropertyGroup" tag of the .net framework console application's ".csproj" file

<RestoreProjectStyle>PackageReference</RestoreProjectStyle> 

There will not be any need to add again the .net standard projects' nuget dependencies in the console application.

like image 56
tech-y Avatar answered Sep 20 '22 23:09

tech-y