本文介绍了将Visual Studio 2017与.Net Core SDK 2.0一起使用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我可以在Visual Studio 2017中打开一个核心2.0项目吗?

Can i open a core 2.0 project in Visual Studio 2017?

我已经安装了最新的dotnet-core(2.0.0-preview2-005840)并创建了核心2.0控制台应用程序。

I've installed the latest dotnet-core (2.0.0-preview2-005840) and created a core 2.0 console-app.

mkdir dn2cli
cd dn2cli
dotnet new console
dotnet restore




  • 在Visual Studio 2017中使用打开项目打开console.csproj

  • 清洁和构建解决方案

  • 我得到了几个错误


    • 其他:

    • 所以。

      c:\Temp>dotnet --info
      .NET Command Line Tools (2.0.0-preview2-005840)
      
      Product Information:  Version:            2.0.0-preview2-005840
      Commit SHA-1 hash:  8f2fcef544
      
      Runtime Environment:  OS Name:     Windows  OS Version:  10.0.14393
      OS Platform: Windows  RID:         win10-x86  Base Path:   C:\Program
      Files (x86)\dotnet\sdk\2.0.0-preview2-005840\
      
      Microsoft .NET Core Shared Framework Host
      
        Version  : 2.0.0-preview1-002061-00   Build    :
      2b70ec9c3b014af0c2a5f45de0e5b73a1ae51c09
      


      推荐答案

      更新

      现在有一个VS 2017 15.3预览版可以解决此问题。从VS 15.3开始,Visual Studio带有一个MSBuild SDK解析器,该解析器确定项目将使用哪个版本的CLI SDK(例如,如果 global.json 设置了版本)并使用它是MSBuild的目标,因此VS可以获取新的预览。

      There is now a VS 2017 15.3 preview that resolves this issue. Starting with VS 15.3, Visual Studio carries an MSBuild SDK resolver that determines which version of the CLI SDK a project would use (e.g. if a global.json sets the version) and uses it's MSBuild targets so new previews are picked up by VS.

      原始

      您可以通过设置 MSBuildSdksPath 来修改您的环境以获得VS 2017对未发布的2.0工具的支持,如,以便VS从CLI提取构建逻辑。

      You can modify your environment to get VS 2017 support for the unreleased 2.0 tooling by setting the MSBuildSdksPath as described in https://github.com/aspnet/Announcements/issues/231 so that VS picks up the build logic from the CLI.

      这篇关于将Visual Studio 2017与.Net Core SDK 2.0一起使用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-23 23:58