Nswag: System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.AspNetCore.Mvc.ViewFeatures

Created on 15 Jan 2018  路  5Comments  路  Source: RicoSuter/NSwag

When loading .NET Assembly Path on Web API Assembly tab I got the following error:

image

I have .NET core instlaled:

PS C:\Windows\system32> dotnet --version
2.1.4

System: Windows 10. Assembly's framework:L .NET Core 2.0.

NSwag.AssemblyLoader question

Most helpful comment

How can I fix this for .NET Core 3.1?

All 5 comments

You have to dotnet publish before loading the DLL because otherwise some framework assemblies are missing...

I've published. First of all - should I add just Web API assembly to ".NET Assembly Paths" or all from the publish directory? Another thing the missing assembly (Microsoft.AspNetCore.Mvc.ViewFeatures) is not present in publish directory...

v11.14.0:

We improved the assembly loader (mainly for .NET Core) so that it runs in a more isolated space and the loaded DLLs should better match the requested versions. Please test this with your projects to ensure that we didnt introduce regressions.

Important if you have DLL loading problems:

  • Check that the DLL in question is available in the output directory (where the selected assembly is located) or in ReferencePaths
  • Check that you selected the correct runtime: Either in NSwagStudio UI, as /runtime parameter in the NPM CLI or execute the correct exe binary

For more information regarding assembly loading: https://github.com/RSuter/NSwag/wiki/Assembly-loading

Main commit: https://github.com/RSuter/NSwag/commit/04576e4d1b714ac5bd9b5df11d72469a23f7c0ff#diff-14dafe6661bab407ae5c0d7095ccd1f4

How can I fix this for .NET Core 3.1?

Was this page helpful?
0 / 5 - 0 ratings