我有一台新的Windows 10笔记本电脑,上面装有VS Pro 2019,当我创建一个非常简单的.net core 2.1项目时,“使用系统”。立即被标记为错误。
CS0246找不到类型或名称空间名称“系统”(您是否缺少using指令或程序集引用?)
我从https://my.visualstudio.com/Subscriptions下载了VS 2019
尝试:
Build - Clean
Build - Rebuild
Nuget command dotnet restore
Deleted /obj folder to regenerate it
Delete .nuget folder to regenerate it
Uninstalled / reinstalled VS Pro 10
如果我将项目属性更改为.net core 2.0,那么问题就消失了。
.net std项目运行正常,没有错误。
using System; // <== Error on this line and more below
namespace TestCore
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Hello World!");
}
}
}
我在做什么错?这让我发疯。谢谢!
PS:
.NET Core SDK (reflecting any global.json):
Version: 2.1.700
Commit: c2ef055a0f
Runtime Environment:
OS Name: Windows
OS Version: 10.0.17763
OS Platform: Windows
RID: win10-x64
Base Path: C:\Program Files\dotnet\sdk\2.1.700\
Host (useful for support):
Version: 2.1.11
Commit: d6a5616240
.NET Core SDKs installed:
2.1.700 [C:\Program Files\dotnet\sdk]
.NET Core runtimes installed:
Microsoft.AspNetCore.All 2.1.11 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.App 2.1.11 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 2.1.11 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
To install additional .NET Core runtimes or SDKs:
https://aka.ms/dotnet-download