UWP references fail when setting TargetPlatformMinVersion
dotMorten opened this issue · comments
Morten Nielsen commented
Create a multi-targeted project like this:
<Project Sdk="MSBuild.Sdk.Extras/3.0.44">
<PropertyGroup>
<TargetFrameworks>netstandard2.0;uap10.0.19041</TargetFrameworks>
<TargetPlatformMinVersion Condition="'$(TargetFramework)'=='uap10.0.10941'">10.0.17763.0</TargetPlatformMinVersion>
</PropertyGroup>
</Project>
Next create a second project that references this:
<Project Sdk="MSBuild.Sdk.Extras/3.0.44">
<PropertyGroup>
<TargetFramework>uap10.0.19041</TargetFramework>
<TargetPlatformMinVersion>10.0.17763.0</TargetPlatformMinVersion> <!-- Remove and problem gone -->
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\Common\Common.csproj" />
</ItemGroup>
</Project>
This causes the build error
2>E:\sources.tmp\BuildRepro\Common\Common.csproj : error MSB4057: The target "GetTargetPath" does not exist in the project.
2>Done building project "Common.csproj" -- FAILED.
If you remove TargetPlatformMinVersion or set it to 19041 on the second project, the problem goes away.
If you replace the second project with a classic UWP class library project, there is no issue.
Morten Nielsen commented
Found a workaround: In the second project pluralize TFM so it says TargetFrameworks
and problem goes away 🤦