VS 2017 new project format and external props file

北慕城南 提交于 2019-12-07 19:29:30

问题


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>

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.


回答1:


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.

See https://github.com/dotnet/project-system/issues/1358.



来源:https://stackoverflow.com/questions/45154654/vs-2017-new-project-format-and-external-props-file

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!