问题
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