`dotnet run` vs `dotnet publish`


I have an asp.net core project that runs fine in VS and even with dotnet run but when I dotnet publish -c Release -o publish it and try to run it with dotnet publish/Web.dll it runs for a bit then fails with

Unhandled Exception: System.IO.FileLoadException: Could not load file or assembly 'netstandard, Version=, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
   at Microsoft.Extensions.DependencyInjection.EncoderServiceCollectionExtensions.AddWebEncoders(IServiceCollection services)
   at Microsoft.Extensions.DependencyInjection.AuthenticationServiceCollectionExtensions.AddAuthentication(IServiceCollection services)
   at Microsoft.AspNetCore.Hosting.Internal.WebHost.Initialize()
   at Microsoft.AspNetCore.Hosting.WebHostBuilder.Build()
   at Web.Program.main(String[] args) in C:\_work\website_tq\tqit8\Web\Startup.fs:line 93

The netstandard.dll is placed in publish/refs. Is that a problem?

asked on Stack Overflow Jan 24, 2020 by Ray

0 Answers

Nobody has answered this question yet.

User contributions licensed under CC BY-SA 3.0