Alex I
Alex I

Reputation: 2400

VS 2017 new project format and external props file

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.

Upvotes: 3

Views: 2336

Answers (1)

natemcmaster
natemcmaster

Reputation: 26823

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.

Upvotes: 3

Related Questions