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

偶尔善良 提交于 2019-12-04 10:59:21

问题


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?


回答1:


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.



来源:https://stackoverflow.com/questions/51155274/copy-all-dependencies-from-net-standard-libraries-to-net-framework-console-app

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!