找不到系统Visual Studio 2017 ASP.NET Core项目 [英] System could not be found Visual Studio 2017 ASP.NET Core project

查看:352
本文介绍了找不到系统Visual Studio 2017 ASP.NET Core项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经安装了新发布的Visual Studio 2017版本,并开始了一个新的针对.NET Core的ASP.NET Core项目。

I've installed the newly released version of Visual Studio 2017 and started a fresh ASP.NET Core project targeting .NET Core.

开箱即用,我'正在获取

Out of the box, I'm getting the


找不到类型或名称空间名称'System'(您
缺少using指令还是程序集引用?)

The type or namespace name 'System' could not be found (are you missing a using directive or an assembly reference?)

错误。知道是什么原因以及如何解决这个问题吗?

error. Any idea what's causing this and how to fix it?

同样,NuGet软件包也存在问题:

Also, looks like there are problems with NuGet packages as well:

我还尝试了dotnet恢复通过命令行在项目上找到以下错误:

I also tried dotnet restore on the project through the command line and got the following error:

PS令人沮丧的是,您在最新版本的Visual Studio 2017中的一个新项目中遇到错误!

P.S. Kind of disheartening that you get an error in a fresh new project in the latest version of Visual Studio 2017!

更新:
SDK版本是v 1.0.1 -如下所示:

UPDATE: SDK version is v 1.0.1 -- see below:

更新2:
这很奇怪。看起来原来的问题是由于NuGet包源指向Visual Studio 2015文件夹下的文件夹所致。我取消选中它,只剩下nuget.org。有了这个项目,我的项目似乎已经还原了所有软件包,并且在我启动项目时,它加载了标准的ASP.NET页面。但是,如果我打开startup.cs文件,到处都会出现红色弯曲,但是如果我运行该项目,它就可以正常工作。这里发生了什么?

UPDATE 2: This is very strange. Looks like the original problem was due to NuGet package source pointing to a folder under Visual Studio 2015 folder. I unchecked it and left only nuget.org. With that my project seemed to have restored all the packages and when I started the project it loads up the standard ASP.NET page. But if I open startup.cs file, I get red squigglies all over the place but if I run the project, it works fine. What's going on here?

更新3:
我关闭了该项目并使用了VS2017。然后重新启动了VS 2017并打开了该项目,现在看起来还不错。而且我没有引用.NETStandard库1.6.1,现在似乎一切正常。

UPDATE 3: I closed the project and VS 2017. I then restarted VS 2017 and opened the project and now it seems to be fine. And I'm not referencing the .NETStandard library 1.6.1 and everything seems to be working fine now.

推荐答案

今天同样的问题。我有一个不再存在的旧nuget源。因此,我进入工具> Nuget数据包管理器,然后取消选中了错误的一个。点击确定,然后重建项目,现在效果很好。似乎您偶然发现了它,但还想验证它是否解决了我的问题,并且确实如此。

Came across the same issue today. I had an old nuget source that no longer existed. So I went into Tools > Nuget Packet Manager and un-checked the wrong one. Hit "Ok", and then rebuilt the project, and it works great now. It seems like you stumbled onto it, but also wanted to verify that it fixed my issue, and it does.

这篇关于找不到系统Visual Studio 2017 ASP.NET Core项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆