dotnet / msbuild

The Microsoft Build Engine (MSBuild) is the build platform for .NET and Visual Studio.
https://docs.microsoft.com/visualstudio/msbuild/msbuild
MIT License
5.22k stars 1.35k forks source link

mono/msbuild forces pdb portable, unable to use pdb2mdb #4223

Open applejag opened 5 years ago

applejag commented 5 years ago

Trying to use mono's pdb2mdb in a Docker container. But I'm always getting:

Error: A portable PDB can't be converted to mdb.

This has boiled down to me finding that when I use msbuild in the Docker container, it always produces portable PDB files, no-matter what I supply with either the /p:DebugType=Full flag on msbuild, or via the DebugType property in my .csproj files.

This only happens for me when I use the linux distribution of .NET Core SDK for Docker (2.2.104) (mcr.microsoft.com/dotnet/core/sdk:2.2) and not with my windows dotnet installation.

I found while doing a --verbose=Diagnostic build (when having DebugType set in the .csproj) that this one item occurs:

Property reassignment: $(DebugType)="portable" (previous value: "full") at /usr/lib/mono/msbuild/15.0/bin/Microsoft.CSharp.Mono.targets (47,9)

Why is it overriding my DebugType property? Why is it doing that?

Steps to reproduce

Via using Docker:

#<inside the host machine>
docker run --rm -it mcr.microsoft.com/dotnet/core/sdk:2.2

#<inside the docker container>
# installation of mono
apt update && \
apt install apt-transport-https dirmngr gnupg ca-certificates -y && \
apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF && \
echo "deb https://download.mono-project.com/repo/debian stable-stretch main" | tee /etc/apt/sources.list.d/mono-official-stable.list

# testlib
dotnet new classlib -o ~/testlib

# via msbuild mono
msbuild ~/testlib/testlib.csproj /p:DebugType=Full /p:OutDir=/root/1

# via dotnet build
dotnet build ~/testlib/testlib.csproj /p:DebugType=Full -o /root/2

Can also install text editor like nano and edit ~/testlib/testlib.csproj and add the <DebugType>Full</DebugType> property.

Both via dotnet build and msbuild results in portable pdb. Peek at ~/1/testlib.pdb and ~/2/testlib.pdb, and see theire all portable pdbs. Not what I requested.

OS info:

If applicable, version of the tool that invokes MSBuild (Visual Studio, dotnet CLI, etc):

Host OS: Windows 10 Home, 10.0.17763, Build 17763

Docker container OS (running in Hyper-V): Debian GNU/Linux 9 (stretch)
docker image: `mcr.microsoft.com/dotnet/core/sdk:2.2`

mono: Mono JIT compiler version 5.18.0.225 (tarball Wed Jan  2 21:21:16 UTC 2019)
dotnet: .NET Command Line Tools (2.2.104)
dotnet build: Microsoft (R) Build Engine version 15.9.20+g88f5fadfbe for .NET Core
livarcocc commented 5 years ago

This happens because generating full pdbs is not supported on for .NET Core. If you are using core (dotnet), it only supports portable pdbs. If you want to generate full pdbs, I suggest using windows. I believe the same is true for mono, which is why you mentioned the property setting above. In any case, looping in @radical to make an accurate comment and guidance on mono.