WPF's inner build (wpftmp.csproj) preprocess view lies
See original GitHub issueGiven a WPF project such as:
<Project Sdk="Microsoft.NET.Sdk.WindowsDesktop">
<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>netcoreapp5.0</TargetFramework>
<UseWPF>true</UseWPF>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Nerdbank.GitVersioning" Version="3.1.13-beta">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
</ItemGroup>
</Project>
Where MainWindow.xaml.cs
includes the line:
Title = ThisAssembly.AssemblyFileVersion;
A build error follows. This is because of https://github.com/NuGet/Home/issues/5894, which is beside the point. The point is, in investigating the failure, I use the /bl
switch and load the file into msbuild structured log viewer. I then find the wpftmp.csproj and click the Preprocess command on it, which shows me this:
From this screenshot you’ll see that nerdbank.gitversioning.targets have been imported. But in fact, I don’t believe they have, since it it was imported there would not be a build failure. Also the side effects of having imported it such as influence on project properties would be visible in the evaluation model which the Properties tree within the structured log viewer does not show are present.
Finally, when I run msbuild WpfApp3_meucdeke_wpftmp.csproj /p:_TargetAssemblyProjectName=WpfApp3,IntermediateOutputPath=obj\Debug\netcoreapp5.0\,AssemblyName=WpfApp3 /pp:out.xml
myself and inspect the out.xml
file, there’s no trace of the nerdbank.gitversioning.targets file having been imported.
Issue Analytics
- State:
- Created 4 years ago
- Comments:11 (11 by maintainers)
I filed https://github.com/microsoft/msbuild/issues/4926
Sure. I’ll try. Netcoreapp5.0 isn’t important though. It happens on 3.0 too.