VS 2017新项目格式和外部道具文件 [英] VS 2017 new project format and external props file

查看:67
本文介绍了VS 2017新项目格式和外部道具文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

可以说我有以下项目文件:

Lets say I have the following project file:

<Project>

  <Import Project="Sdk.props" Sdk="Microsoft.NET.Sdk" />

  <PropertyGroup>
    <TargetFramework>net47</TargetFramework>
  </PropertyGroup>

  <Import Project="Sdk.targets" Sdk="Microsoft.NET.Sdk" />

</Project>

是否可以将TargetFramework属性移动到外部props文件?当我尝试这样做时,Visual Studio会给我一个单向升级"错误.

Is it possible to move TargetFramework property to external props file? When I try doing that, Visual Studio gives me a "one-way upgrade" error.

推荐答案

您在Visual Studio解释csproj文件的方式中遇到了一个已知问题.在命令行(msbuild.exe或dotnet.exe)上,可以使用导入的文件中的属性TargetFramework来构建项目.但是,Visual Studio在导入时无法识别它.

You've hit a known issue in the way that Visual Studio interprets csproj files. On command line (msbuild.exe or dotnet.exe) you can build a project with the property TargetFramework coming in from an imported file. Visual Studio, however, does not recognize this when it is imported.

请参见 https://github.com/dotnet/project-system/issues/1358 .

这篇关于VS 2017新项目格式和外部道具文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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