简体   繁体   中英

Predefined type 'System.Object/String' is not defined or imported

I have created the default ASP .NET Core MVC app in Visual Studio 2017 and there are 100+ errors and 44 warnings. The errors are:

  1. Predefined type 'System.Object' is not defined or imported
  2. Predefined type 'System.String' is not defined or imported
  3. Predefined type 'System.Int32' is not defined or imported

I have tried these: - restart and reinstall VS - delete the bin and obj folders - rebuild the project - dotnet restore reopen the project in VS

project: https://github.com/martin-petrov03/Demo/tree/master/Ex

I recently experience the same. I eventually fixed the issue by removing the offending projects from the solution and then re-adding them (you can actually just 'unload' them).

I encountered this problem today too. It turned out that adding this text:

  <ItemGroup>
    <PackageReference Include="Microsoft.NETCore.UniversalWindowsPlatform">
      <Version>6.2.10</Version>
    </PackageReference>
  </ItemGroup>

into my UWP.csproj caused the problem to go away

Removing the bindings to other projects and re-adding them works for me, thank you for your suggestion @Trevor !!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM