After updating and including some NuGet packages, I now get many compile errors similar to:
The type 'Object' is defined in an assembly that is not referenced. You must add a reference to assembly 'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'
I looked at You must add a reference to assembly mscorlib, version=4.0.0 but I'm not running .Net core - this is an ASP.NET MVC, .Net Framework 4.7.2 Project.
There is no project.json to update. I already included the Microsoft.NETCore.Portable.Compatibility NuGet package to no effect.
What is causing this, and how can I fix it?
Right-Click on your project and click Clean Solution in Visual Studio, and then try building it again. Solves the problem most of the time for me. Or else, in case you copy-pasted a class from somewhere else, try creating a new class in your project and instead, copy-paste the code within the other class instead of just copying the class itself.
I also faced the same issue, I got this when I was trying to install EntityFramework. Code Clean-Up worked for me. Go to analyze and then try to run code cleanup using both profiles.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With