VisualStudio2017安装中断 VisualStudio2015ASP.NET 核心项目

在安装了 VisualStudio2017Professional 之后,我不能再在 VisualStudio2015Professional 中构建 ASP.NET 核心了。我从未在 VS2017中打开过这个项目

我明白

试图运行项目模型服务器进程时发生了以下错误(1.0.0-preview3-004056)。

无法启动进程。找不到与命令 dotnet-projectmodel-server 匹配的可执行文件

enter image description here

然后,我在 VisualStudio2015中创建了一个全新的 ASP.NET Core 项目,并且在加载项目时得到了完全相同的消息。

另外,当我想构建项目时,我得到

项目文件不存在。

enter image description here

同样的问题不会出现在 ASP.NET 5项目中,所以它只限于 ASP.NET 核心


Visual Studio 2017年3月7日更新

如果在下面的答案中添加 global.json,则会得到错误消息。在 global.json中使用的并且存在于 C:\Program Files\dotnet\sdk\文件夹中的 net 框架版本

错误 MSB4019导入的项目“ C: Program Files DotNet sdk X.X.X Microsoft VisualStudio v14.0 DotNet Microsoft。网络。“道具”没有找到。确认声明中的路径是正确的,并且该文件存在于磁盘上。

此外,当关闭 VisualStudio 并重新打开它时,我会得到原始的错误消息

16610 次浏览

Take a look at this link: https://github.com/aspnet/Tooling/blob/master/known-issues-vs2017.md#known-issues-for-aspnet-core-support-in-visual-studio-2017

If you update the tooling for Visual Studio 2015 to the latest version, it should fix the issue. Note this is not the Visual Studio 2015 update, but the ASP.NET Core and tooling.

Go to Programs and Resources, use "Core" to filter and find Preview 3 installation ("Microsoft .NET Core 1.0.1 - SDK Preview 3 (x64).") and remove it.

NOTE: Run dotnet --version before and after remove this SDK. On my case results in 1.0.0-preview3-004056(before) and 1.0.0-preview2-1-003177(after).

I can't see side effects on vs2017 yet.

@ClaudioNunes and @MegaTron have the correct answer. After reading that answer, I realized my .NET Core solution did not have a global.json file. I added a new solution folder and added a global.json file. Since none of my projects are nested in sub folders, I only had to remove "src" and "test" from the projects array:

{
"projects": [],
"sdk": {
"version": "1.0.0-preview2-003131"
}
}

The project now opens correctly in VS 2015 with VS 2017 RC installed.

A possible workaround is to add a global.json to solution and specify the sdk version to be used as in

{
"projects": [ "src", "test" ],
"sdk": {
"version": "1.0.0-preview2-003131"
}
}

The project upgrade has been improved from Visual Studio 2017 RC to Visual Studio 2017 RTM and is working now.

I ended up opening my Visual Studio 2015 ASP.NET Core Solution in Visual Studio 2017 which upgraded each project in the solution. I then updated the nuget packages and the solution worked without any side effects.