Exception after updating from preview to .net core

2020-05-08 07:30发布

问题:

I got this error in the browser after updating to .net core release 3.0:

TypeLoadException: Could not load type 'System.Diagnostics.CodeAnalysis.MaybeNullAttribute' from assembly 'netstandard, Version=2.1.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51

I've updated everything to latest version 3.0. Is it a bug? What should i do?

回答1:

This error occurred when using preview SDK of .NET Core. Based on this git thread:

  • Make sure all .net core runtimes and SDKs are uninstalled. Run dotnet --info to see. If installing 3.0.100 didnt remove the previews, go to those dirs and manually remove them. Re install (modify) the net core 3.0.100 installation to be safe again.

  • Make sure you have installed VS 2019 16.3.1