dotnet / dotnet/msbuild

Native (CL compiler) PDB files not copied into output unless ConfigurationName is Debug

Open
#2,353 0 comments 2 reactions 0 assignees View on GitHub
triaged
Dominant language
C#
Stars
5.5k
Forks
1.5k
Avg merge
1d 13h
Merged PRs (30d)
133

Description

`_DebugSymbolsProduced` internal variable controls whether PDB files are copied from build folder into output folder after build is completed.

This variable is set in:
https://github.com/Microsoft/msbuild/blob/master/src/Tasks/Microsoft.Common.CurrentVersion.targets#L145-L151

There are .NET compiler specific conditions using `DebugType`, but it does not check CL specific conditions like `'$(DebugInformationFormat)'!='none' `, thus regardless of what/if CL if producing PDB, only condition applicable to CL is first generic (wrong?) one:
~~~xml
true
...
<_DebugSymbolsProduced Condition="'$(DebugSymbols)'=='true'">true
~~~
Such behavior is wrong in principle, as it makes some assumptions on configuration name, see #2170.

This also related to:
- https://github.com/Microsoft/msbuild/pull/379
- https://github.com/Microsoft/msbuild/issues/2170
- https://github.com/Microsoft/msbuild/issues/2169

Contributor guide

No contributing guide indexed for this repository

Research direction

Start in src/Tasks/Microsoft.Common.CurrentVersion.targets at the _DebugSymbolsProduced definition around lines 145-151, then trace how CL uses DebugInformationFormat versus the generic DebugSymbols conditions. Reproduce a native build with a non-Debug ConfigurationName and PDB generation enabled; done means the produced PDB is copied to the output without relying on the configuration name.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
build-system
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.