Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Disable generating PDB files in MsBuild

I'm looking to squeeze some more speed out of my build and was wondering if I could instruct msbuild to not generate PDB files. I'm passing the Configuration=Release and DebugSymbols=false property with no luck.

like image 780
Ryu Avatar asked Apr 21 '09 17:04

Ryu


People also ask

How do I prevent PDB files?

If you really want to turn them off, that's always an option. In your project's Properties window, set the "Debug Info" option to "none" for any configuration you want to change. Do note, however, that the "Debug" and "Release" configurations do by default use different settings for emitting debug information.

Are PDB files required?

No, you don't have to deploy the . pdb file. To quote from MSDN, "A PDB file is created when you build with /debug (Visual Basic/C#).", so it shouldn't be creating the debug database when compiling for release.

Do PDB files affect performance?

The executive summary answer: no, generating PDB files will have no impact on performance whatsoever.

How is a PDB file created?

A PDB file is typically created from source files during compilation. It stores a list of all symbols in a module with their addresses and possibly the name of the file and the line on which the symbol was declared. This symbol information is not stored in the module itself, because it takes up a lot of space.

How to generate PDB file in Visual Studio 2022?

If a project having static library output is compiled in Visual Studio 2022, pdb file is generated in static library output path even if different pdb path is given in C/C++->OutputFiles->ProgramDatabaseFileName.

What is the erroronduplicatepublishoutputfiles property in MSBuild?

The ErrorOnDuplicatePublishOutputFiles property relates to whether the SDK generates error NETSDK1148 when MSBuild detects duplicate files in the publish output, but can't determine which files to remove. Set the ErrorOnDuplicatePublishOutputFiles property to false if you don't want the error to be generated.

How do I disable a framework-dependent executable in MSBuild?

In .NET Core 3.0 and later versions, a framework-dependent executable is created by default. Set the UseAppHost property to false to disable generation of the executable. For more information about deployment, see .NET application deployment. The following MSBuild properties are documented in this section:

How do I configure run-time behavior in MSBuild?

You can configure some run-time behaviors by specifying MSBuild properties in the project file of the app. For information about other ways of configuring run-time behavior, see Runtime configuration settings. The ConcurrentGarbageCollection property configures whether background (concurrent) garbage collection is enabled.


1 Answers

You may have PDB generation in your release configuration. Add this to your release settings:

<DebugSymbols>false</DebugSymbols> <DebugType>None</DebugType> 

You can also, do this in your project configuration inside visual studio. Disable PDB Generation

Also, if running MSBuild from the command line, the command line arguments would be

MSBuild.exe YourProject.csproj /p:DebugSymbols=false /p:DebugType=None 
like image 77
Jose Basilio Avatar answered Nov 05 '22 17:11

Jose Basilio