xsharp.eu • File paths in PDB files
Page 1 of 1

File paths in PDB files

Posted: Fri Aug 07, 2020 9:35 am
by leon-ts
Hi all,

Is there any setting that can be used to specify that only the relative path to the source code files is saved in the output PDB file? By default, the PDB file stores the full path to the source files on the build machine.

This can be inconvenient for several reasons if this build is production and is intended to be run on the client. For example, the path can be very long and the potential error message can be unwieldy. Also, the path of placing projects can to some extent be attributed to confidential information and I would not want to show it to third parties.

Maybe someone knows if there is such a possibility (an option for generating a PDB) and if so, how to enable it?

Best regards,
Leonid

File paths in PDB files

Posted: Fri Aug 07, 2020 9:47 am
by robert
Leonid,
I have not used it, but you should look at the pathmap commandline argument:
See https://docs.microsoft.com/en-us/dotnet ... ler-option
and
https://www.xsharp.eu/help/opt-pathmap.html

You cannot set this property through our UI but you should be able to add a <pathmap></pathmap> entry to the VS project properties to automatically add this to the compiler command line. Of course you can also use the entry on the build page to specify additional commandline options.

Robert

File paths in PDB files

Posted: Fri Aug 07, 2020 10:38 am
by leon-ts
Robert,

It works and is exactly what I need!

Code: Select all

<pathmap></pathmap>
Many many thanks!

P.S. I couldn't do it through the additional command line options on the Build page. Throws an error: The pathmap option was incorrectly formatted. I entered in the input field:

Code: Select all

-pathmap:D:ProjectsVisual Studio 2019TestConsoleApplicationTestConsoleApplication=TestConsoleApplication
But it is enough for me that it works through xsproj.

Best regards,
Leonid

File paths in PDB files

Posted: Fri Aug 07, 2020 11:14 am
by robert
Leonid
Another example that proves that it was a good idea to build our compiler on top of Roslyn

Robert