Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing symbols package when building in dotnet msbuild workflow (mspdbcmf.exe not found) #5102

Open
riverar opened this issue Feb 5, 2025 · 3 comments
Assignees
Labels
area-DeveloperTools Issues related to authoring (source and IDL), debugging, HotReload, LiveVisualTree, VS integration feature proposal

Comments

@riverar
Copy link
Contributor

riverar commented Feb 5, 2025

Describe the bug

When using dotnet msbuild to MSIX package a blank WinAppSDK/WinUI application, the symbol package creation fails with a warning.

[...]\microsoft.windowsappsdk\1.6.250108002\buildTransitive\Microsoft.Build.Msix.Packaging.targets(363,5): warning : Path to mspdbcmf.exe could not be found. A symbols package will not be generated. Review https://aka.ms/windowsappsdkdocs and ensure that all prerequisites for Windows App SDK development have been installed.

The documentation link in the warning has no pertinent information for the warning it's attached to.

Incorrectly closed and related issue: #2963

Steps to reproduce the bug

  1. git clone https://github.com/riverar/repro-211f09d9fccb
  2. cd repro-211f09d9fccb
  3. dotnet msbuild /p:Configuration=Release /p:AppxPackageDir="MSIXOutputX64\" /p:GenerateAppxPackageOnBuild=true /p:Platform=x64 -bl
  4. Observe warning/failure
  5. (Optional) Open msbuild.binlog and observe VC specific variables are not resolving (in the _EnsurePdbCmfExeFullPath target)

Expected behavior

Symbols package creation to succeed without warnings

Screenshots

No response

NuGet package version

Windows App SDK 1.6.3: 1.6.250108002

Packaging type

Packaged (MSIX)

Windows version

Insider Build (xxxxx)

IDE

Visual Studio 2022-preview, Other, Visual Studio 2022

Additional context

It was previously stated that dotnet build workflows are supported (microsoft/microsoft-ui-xaml#5327).

Microsoft.Build.Msix.Packaging.targets does not appear to take into account that VC variables don't exist when built via this context.

  <Target Name="_EnsurePdbCmfExeFullPath" Condition="'$(MsPdbCmfExeFullpath)' == ''">
    <GetLatestMSVCVersion MSVCDirectoryPath="$(VsInstallRoot)\VC\Tools\MSVC" Condition="'$(VCToolsInstallDir)' == '' and '$(VsInstallRoot)' != ''">
      <Output TaskParameter="LatestMSVCVersion" PropertyName="LatestMSVCVersion"/>
    </GetLatestMSVCVersion>

    <!-- We'll first try to get mspdbcmf.exe from VC++ UWP tools -->
    <PropertyGroup Condition="'$(VCToolsInstallDir)' == '' and '$(VsInstallRoot)' != ''">
      <VCToolsInstallDir Condition="'$(VCToolsInstallDir)' == ''">$(VsInstallRoot)\VC\Tools\MSVC\$(LatestMSVCVersion)\</VCToolsInstallDir>
    </PropertyGroup>
    <PropertyGroup Condition="'$(VCToolsInstallDir)' != ''">
      <_VCInstallPathHostArchitecture Condition="'$(PROCESSOR_ARCHITECTURE)' == 'x86'">X86</_VCInstallPathHostArchitecture>
      <_VCInstallPathHostArchitecture Condition="'$(PROCESSOR_ARCHITECTURE)' != 'x86'">X64</_VCInstallPathHostArchitecture>
      <PdbCmfx86ExeFullPath>$(VCToolsInstallDir)bin\Host$(_VCInstallPathHostArchitecture)\x86\mspdbcmf.exe</PdbCmfx86ExeFullPath>
      <PdbCmfx64ExeFullPath>$(VCToolsInstallDir)bin\Host$(_VCInstallPathHostArchitecture)\x64\mspdbcmf.exe</PdbCmfx64ExeFullPath>
    </PropertyGroup>

    <!-- Next we'll try the copy included with the `Microsoft.VisualStudio.Windows.Build` VS component -->
    <PropertyGroup Condition="'$(PdbCmfx86ExeFullPath)' == '' or '$(PdbCmfx64ExeFullPath)' == ''">
      <AppxMSBuildToolsPath Condition="'$(AppxMSBuildToolsPath)' == ''">$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v$(VisualStudioVersion)\AppxPackage\</AppxMSBuildToolsPath>
      <PdbCmfx86ExeFullPath Condition=" '$(PdbCmfx86ExeFullPath)' == '' ">$(AppxMSBuildToolsPath)\x86\mspdbcmf.exe</PdbCmfx86ExeFullPath>
      <PdbCmfx64ExeFullPath Condition=" '$(PdbCmfx64ExeFullPath)' == '' ">$(AppxMSBuildToolsPath)\x64\mspdbcmf.exe</PdbCmfx64ExeFullPath>
    </PropertyGroup>

    <PropertyGroup>
      <MsPdbCmfExeFullpath Condition="'$(MSBuildExtensionsPath64)' != ''">$(PdbCmfx64ExeFullPath)</MsPdbCmfExeFullpath>
      <MsPdbCmfExeFullpath Condition="'$(MSBuildExtensionsPath64)' == ''">$(PdbCmfx86ExeFullPath)</MsPdbCmfExeFullpath>
    </PropertyGroup>

    <Warning Text="Path to `mspdbcmf.exe` could not be found. A symbols package will not be generated. Review https://aka.ms/windowsappsdkdocs and ensure that all prerequisites for Windows App SDK development have been installed."
             Condition="!(Exists('$(MsPdbCmfExeFullpath)') and '@(PDBPayload)' != '')" />
  </Target>
@DarranRowe
Copy link

DarranRowe commented Feb 5, 2025

That falls back to the MSBuild path if the VC path fails.

Image

So if doesn't find the VC directories, it should then look for $(MSBuildExtensionsPath), and this is documented to be a well known property. Does the log contain anything about why it didn't try to use the alternate method when $(PdbCmfx86ExeFullPath) and $(PdbCmfx64ExeFullPath) both evaluated to empty?

@riverar
Copy link
Contributor Author

riverar commented Feb 5, 2025

Repro was provided above.

Suspect you're referring to:

<!-- Next we'll try the copy included with the `Microsoft.VisualStudio.Windows.Build` VS component -->
<PropertyGroup Condition="'$(PdbCmfx86ExeFullPath)' == '' or '$(PdbCmfx64ExeFullPath)' == ''">
  <AppxMSBuildToolsPath Condition="'$(AppxMSBuildToolsPath)' == ''">$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v$(VisualStudioVersion)\AppxPackage\</AppxMSBuildToolsPath>
  <PdbCmfx86ExeFullPath Condition=" '$(PdbCmfx86ExeFullPath)' == '' ">$(AppxMSBuildToolsPath)\x86\mspdbcmf.exe</PdbCmfx86ExeFullPath>
  <PdbCmfx64ExeFullPath Condition=" '$(PdbCmfx64ExeFullPath)' == '' ">$(AppxMSBuildToolsPath)\x64\mspdbcmf.exe</PdbCmfx64ExeFullPath>
</PropertyGroup>

In this case:
AppxMSBuildToolsPath = C:\Program Files\dotnet\sdk\9.0.102\\Microsoft\VisualStudio\v17.0\AppxPackage\
(MSBuildExtensionsPath points to dotnet SDK root)

This location does not exist. None of my installed SDKs have this directory structure.

@RDMacLachlan RDMacLachlan added area-DeveloperTools Issues related to authoring (source and IDL), debugging, HotReload, LiveVisualTree, VS integration feature proposal and removed needs-triage labels Feb 6, 2025
@RDMacLachlan
Copy link
Member

Thank you for raising this GitHub Issue. The team will be investigating ways to improve this experience with the development tools.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-DeveloperTools Issues related to authoring (source and IDL), debugging, HotReload, LiveVisualTree, VS integration feature proposal
Projects
None yet
Development

No branches or pull requests

4 participants