如何在Visual Studio 2017中打开dotnet-core CLI项目 [英] How to open dotnet-core CLI project in Visual Studio 2017

查看:211
本文介绍了如何在Visual Studio 2017中打开dotnet-core CLI项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

为了学习两者,我一直在使用dotnet Core(用于API)和Angular2开发一个简单的应用程序。

I have been developing a simple application using dotnet Core (for an API) and Angular2 for the purpose of learning both.

我是在命令行上使用Yeoman创建的项目,并且一直在使用Visual Studio Code(在Windows上)愉快地编码。所有人似乎在一起很好,这是一种令人愉快的体验。

I created the project using Yeoman on the command line and have been happily coding away in Visual Studio Code (on Windows). All seems to hang together well and it's been an enjoyable experience.

我想我可以尝试Visual Studio 2017,看看一段时间内在VS中开发dotnet Core项目的经历是什么样的。

I thought I might try out Visual Studio 2017 and see what the experience of developing a dotnet Core project in VS is like for a while.

但是,安装了VS2017并从github克隆了项目后,我不确定如何继续。我看不到任何还原/构建/运行项目的方法。

克隆仓库后,我看到我的项目显示在解决方案资源管理器中,显示为project.json文件可见。但是,调试|开始显示为灰色。我在VS2017上读过一些文章,需要将project.json转换为新的(旧的?)XML格式,并且我感觉到我缺少.sln文件。

After cloning the repo, I see my project displayed in the Solution Explorer with the project.json file visible. However, Debug | Start is greyed out. I read somewhere about VS2017 needing to convert project.json to the new (old?) XML format and also I have a feeling I am missing a .sln file.

如果有人能指出我正确的方向,我将不胜感激。

I would appreciate it if someone could point me in the right direction.

推荐答案

如果您的项目中有 .xproj 文件



If your project has an .xproj file


  1. 打开Visual Studio。

  2. 文件>打开>项目/解决方案。

  3. 为您的解决方案打开 xxx.xproj

  1. Open Visual Studio.
  2. File > Open > Project/Solution.
  3. Open the xxx.xproj for your solution.



如果您的项目缺少 .xproj 文件



If your project lacks an .xproj file


  1. 安装.NET Core SDK 预览3或更高版本

  2. 在项目目录中打开命令提示符。

  3. 运行 dotnet迁移

  4. 打开生成的 .csproj
  5. 在Visual Studio 2017中。
  1. Install .NET Core SDK Preview 3 or higher.
  2. Open a command prompt at your project's directory.
  3. Run dotnet migrate.
  4. Open the resulting .csproj in Visual Studio 2017.



故障排除



使用 dotnet migration -h 查看迁移帮助。

如果您有 global.json 文件,请在运行 migrate之前更新其SDK版本。 。例如。

If you have a global.json file, update its SDK version before running migrate. E.g.

{
    "sdk": {
        "version": "1.0.0-preview4-004233"
    }
}

使用 dir'C:\Program Files\dotnet\sdk\'

更新Visual Studio 2017及其安装程序。在我的计算机上,以上内容适用于Microsoft Visual Studio Community 2017 RC版本 15.0.26014.0 D15REL

Update Visual Studio 2017 and its installer. On my machine, the above works with Microsoft Visual Studio Community 2017 RC Version 15.0.26014.0 D15REL.

Update。 NET Core SDK。在我的机器上,以上代码可用于SDK 1.0.0-preview4-004233

Update .NET Core SDK. On my machine, the above works with SDK 1.0.0-preview4-004233.

这篇关于如何在Visual Studio 2017中打开dotnet-core CLI项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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