Reference .netstandard 2.0 project in core 2.0 Runtime loading error when GenerateAssemblyInfo = false

喜欢而已 提交于 2019-12-31 05:08:05

问题


When we add the reference, we are able to use the .netstandard libs classes in our .net core console project (in Visual Studio), and it compiles.

When we run the app, it immediately crashes with this error in the output window:

An unhandled exception of type 'System.IO.FileNotFoundException' occurred in Unknown Module. Could not load file or assembly 'MyNetStandard20Assembly, Version=0.1.0.0, Culture=en-us, PublicKeyToken=null'. The system cannot find the file specified.


Update / Cause (still looking for reason)

So we use AssemblyInfo files in our projects and in order to make these work with the new project structure we needed to add this to the first PropertyGroup in the .NET Standard project:

<GenerateAssemblyInfo>false</GenerateAssemblyInfo>

That then allows us to have a Properties/AssemblyInfo.cs file in the project, just like a .NET Framework project would allow.

Anyway, when we remove this from the .NET Standard project then the .NET Core project finds the assembly and is happy.

Does anyone know why?

来源:https://stackoverflow.com/questions/48343681/reference-netstandard-2-0-project-in-core-2-0-runtime-loading-error-when-genera

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