共用方式為


Project Settings for C# Debug Configurations

Note

This article applies to Visual Studio 2015. If you're looking for the latest Visual Studio documentation, see Visual Studio documentation. We recommend upgrading to the latest version of Visual Studio. Download it here

You can change the project settings for a C# debug configuration in the Property Pages window, as discussed in Debug and Release Configurations. The following tables show where to find debugger-related settings in the Property Pages window.

Warning

This topic does not apply to Windows Store apps. See Start a debug session (VB, C#, C++ and XAML)

Debug tab

Setting Description
Configuration Sets mode for compiling the application. Choose among Active (Debug), Debug, Release, All Configurations.
Start Action This group of controls specifies the action that will occur when you choose Start from the Debug menu.

- Start project is the default and launches the startup project for debugging. For more information, see Choosing the Startup Project.
- Start external program enables you to start and attach to a program that is not part of a Visual Studio project. For more information, see Attaching to a Running Program.
- Start browser in URL enables you to debug a Web application.
Command line arguments Specifies command-line arguments for the program to be debugged. The command name is the program name specified in Start external program. If Start Action is set to Start URL, command-line arguments cannot be specified.
Working directory Specifies the working directory of the program being debugged. In Visual C#, the working directory is the directory the application is launched from \bin\debug by default.
Use remote machine The name of a remote machine where the application will run for debugging purposes or an Msvsmon server name. The location of the EXE on the remote machine is specified by the Output Path property in the Configuration Properties folder, Build category. The location must be a shareable directory on the remote machine.
Enable unmanaged code debugging Enables you to debug calls to native (unmanaged) Win32 code from your managed application.
Enable SQL Server debugging Allows debugging of SQL Server database objects.

Build tab

Setting Description
Conditional compilation symbols: The DEBUG and TRACE constants are defined here.

These constants enable conditional compilation of the Debug class and Trace class. With these constants defined, Debug and Trace class methods generate output to the Output window. Without these constants, Debug and Trace class methods are not compiled and no output is generated.

- Debug is normally defined in the Debug version of a program and undefined in the Release version.
- Trace is normally defined in both Debug and Release versions.
Optimize code Unless you find a bug that appears only in optimized code, you should leave this setting turned off in the Debug version. Optimized code is harder to debug because instructions do not correspond directly to statements in your source windows.
Output path: Typically set to bin\Debug for debugging.

See Also

Debugger Settings and Preparation