Predefined type 'System.Object' is not defined or imported .net 4.6

后端 未结 12 1175
别那么骄傲
别那么骄傲 2021-02-06 20:02

I\'m using MVC 5 and .net 4.6 to create a web API that my mobile app can connect too.

Whenever I build the project I get hundreds of errors telling me that I need to add

相关标签:
12条回答
  • 2021-02-06 20:59

    In my case, below are the steps I followed;

    1. I removed bin and obj and rebuild. (Didn't work)
    2. Unloaded the project. (It resulted in "Assets file project.assets.json not found. Run a NuGet package restore")
    3. I ran dotnet restore command via Visual Studio 2017 >> Tools >> NuGet Package Manager >> Package Manager Console.
    4. Rebuild solution. (Problem solved)
    0 讨论(0)
  • 2021-02-06 20:59

    I have the same problem. I spent 2 day to resolve this problem. I try reinstall visual, clear cache visual, uninstall visual or setup windows 10 again => but not success.

    You can try follow step, it success for me

    1. Close visual
    2. Delete packages folder in solution folder
    3. Open visual and rebuild solution

    Good luck

    0 讨论(0)
  • 2021-02-06 21:00

    Remove bin and obj and rebuild.

    0 讨论(0)
  • 2021-02-06 21:00

    In my case, I had a project that was still set to build against a beta version of dnx. Changing it to build against the version I was using in the other projects fixed it.

    0 讨论(0)
  • 2021-02-06 21:01

    I just opened Visual Studio "As Administrator" and it worked!

    0 讨论(0)
  • 2021-02-06 21:02

    Took almost 2 days to fix. Tried VS Uninstall\re-install several times but did not work.

    What finally worked for me...

    Ran VS Installer repair. Due to errors, I had to manually uninstall all instances MS .NET Core SDK - 2.1xxx

    Ran VS Installer repair. No errors. Remove bin and obj and rebuild.

    Ran dotnet restore command on Package manager console and problem solved.

    0 讨论(0)
提交回复
热议问题