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

0

1

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?

Jewish answered 19/1, 2018 at 14:49 Comment(2)
It sounds like MyNetStandard20Assembly isn't in the same folder as the executable.Mediatorial
Hi Andy - It is a project reference in the Net-Core project. It does make a copy of the assembly to the bin for the Core app executableJewish

© 2022 - 2024 — McMap. All rights reserved.