microsoft / SizeBench

SizeBench is a binary size investigation tool for Windows
MIT License
103 stars 14 forks source link

MicrosoftDebuggingDataModelDbgModelApiXtnPath empty in Directory.build.targets #18

Closed machish closed 1 year ago

machish commented 1 year ago

I did a build, and saw this warning:

  MSBUILD : warning MSB5029: The value "\**\*" of the "Include" attribute in element <ItemGroup> in file "C:\src
\github\SizeBench\src\Directory.Build.targets (53,11)" is a wildcard that results in enumerating all files on th
e drive, which was likely not intended. Check that referenced properties are always defined.

Directory.build.targets has a line that does this:

    <None Include="$(MicrosoftDebuggingDataModelDbgModelApiXtnPath)\**\*" CopyToOutputDirectory="PreserveNewest" Visible="False" Link="%(RecursiveDir)%(FileName)%(Extension)"/>

which means that MicrosoftDebuggingDataModelDbgModelApiXtnPath must be empty.

Protecting it with a check ('$(MicrosoftDebuggingDataModelDbgModelApiXtnPath)' != '') fixed it for me:

  <!-- This is all the stuff necessary to use DbgX at runtime, it's needed in multiple projects, so it's centralized here -->
  <ItemGroup Condition="'$(IncludeDbgXAssets)'=='true' And '$(MicrosoftDebuggingDataModelDbgModelApiXtnPath)' != ''">
    <Content Include="..\ExternalDependencies\DIA\msdia140.dll">
      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
    </Content>
    <None Include="$(MicrosoftDebuggingDataModelDbgModelApiXtnPath)\**\*" CopyToOutputDirectory="PreserveNewest" Visible="False" Link="%(RecursiveDir)%(FileName)%(Extension)"/>
  </ItemGroup>

I'm not entirely sure why MicrosoftDebuggingDataModelDbgModelApiXtnPath isn't set, but this fixes it for me.

It looks like I don't have permissions to create a Pull Request.

Austin-Lamb commented 1 year ago

Thanks for reporting this - this path gets set by a NuGet package that SizeBench depends on, but the path isn't set until that package is restored, so on the first NuGet restore it'll be empty. Your fix is the right one, so I'll be adding that in a PR shortly along with some other work.

Austin-Lamb commented 1 year ago

This should be fixed now.