问题
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