VS 2017安装后无法运行基于project.json的.Net Core [英] Can't run .Net Core based on project.json after VS 2017 installation

查看:68
本文介绍了VS 2017安装后无法运行基于project.json的.Net Core的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我从事软件开发已经有一段时间了,并且总是使用 dotnet run 来执行它.今天,我决定安装VS 2017,此后(尽管仍不能完全确定这是否是根本原因),我无法再运行我的软件.

I've been working on a software for a while and always executed it using dotnet run. Today, I decided to install VS 2017 and after that (still not entirely sure if it's the root cause, though), I can't run my software anymore.

预先存在的项目与我在VS 2017中打开的项目相距甚远,因此我怀疑唯一的冲突可能是由于更改了Core版本.可以肯定的是,我从页面上重新运行了最新版本.

The pre-existing project is nowhere near the project I opened with VS 2017 so the only collision I suspect might be due to the Core version being changed. To be sure, I re-ran the installation from the page, the latest version.

dotnet --version
1.0.0-preview4-004233

dotnet --version
1.0.0-preview4-004233

我注意到,当我执行 dotnet new 时,该目录得到的是 xxx.csproj 文件,而不是 project.json ,阅读某处MS将放弃对此的支持的地方.

I notice that when I execute dotnet new, the directory get a xxx.csproj file and not project.json and I've read somewhere that MS is going to drop support for it.

我该怎么做才能使先前存在的项目再次运行?我有点陷入整个过程的中间,而谷歌搜索却丝毫不给我任何东西.显然,我是第一个进行此愚蠢升级的家伙(如果是出于这种原因而开始).

What can I do to get the pre-existing project running again? I'm kind of stuck in the middle of the whole thing and googling gave me precisely nothing. Apparently, I'm the first dude to do this stupid upgrade (if it's because of that to begin with).

推荐答案

我该怎么做才能使先前存在的项目再次运行?

What can I do to get the pre-existing project running again?

添加一个 global.json 到项目或解决方案的根目录,并带有指向先前SDK的SDK属性.例如:

Add a global.json to your project or solution's root directory, with an SDK property that points at the previous SDK. For example:

{
    "sdk": {
        "version": "1.0.0-preview2-003131"
    }
}

以这种方式查看已安装的SDK版本:

View the SDK versions that you have installed like this:

PS> dir 'C:\Program Files\dotnet\sdk\' -name

1.0.0-preview2-003131               
1.0.0-preview2-003133               
1.0.0-preview2-003156               
1.0.0-preview2-1-003177             
1.0.0-preview3-004056               

任何带有 preview2 的东西都将使用 project.json ,任何带有 preview3 (或更高版本)的东西都将使用 xxx.csproj .

Anything with preview2 will use project.json, anything with preview3 (or above) will use xxx.csproj.

另请参见:>并排安装.

这篇关于VS 2017安装后无法运行基于project.json的.Net Core的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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