Megosztás a következőn keresztül:


/debug (C# Compiler Options)

The /debug option causes the compiler to generate debugging information and place it in the output file or files.

/debug[+ | -]
/debug:{full | pdbonly}

Arguments

  • + | -
    Specifying +, or just /debug, causes the compiler to generate debugging information and place it in a program database (.pdb file). Specifying -, which is in effect if you do not specify /debug, causes no debug information to be created.

  • full | pdbonly
    Specifies the type of debugging information generated by the compiler. The full argument, which is in effect if you do not specify /debug:pdbonly, enables attaching a debugger to the running program. Specifying pdbonly allows source code debugging when the program is started in the debugger but will only display assembler when the running program is attached to the debugger.

Remarks

Use this option to create debug builds. If /debug, /debug+, or /debug:full is not specified, you will not be able to debug the output file of your program.

If you use /debug:full, be aware that there is some impact on the speed and size of JIT optimized code and a small impact on code quality with /debug:full. We recommend /debug:pdbonly or no PDB for generating release code.

Note

One difference between /debug:pdbonly and /debug:full is that with /debug:full the compiler emits a DebuggableAttribute, which is used to tell the JIT compiler that debug information is available. Therefore, you will get an error if your code contains the DebuggableAttribute set to false if you use /debug:full.

For more information on how to configure the debug performance of an application, see Making an Image Easier to Debug.

To change the location of the .pdb file, see /pdb (C# Compiler Options).

To set this compiler option in the Visual Studio development environment

  1. Open the project's Properties page.

  2. Click the Build property page.

  3. Click the Advanced button.

  4. Modify the Debug Info property.

For information on how to set this compiler option programmatically, see DebugSymbols.

Example

Place debugging information in output file app.pdb:

csc /debug /pdb:app.pdb test.cs

See Also

Other Resources

C# Compiler Options

Project Properties (Visual Studio)