This documentation is archived and is not being maintained.

Properties Property (Visual Basic and Visual C# Configuration Object)

Visual Studio .NET 2003

Each Configuration object returned by the ConfigurationManager.Item property has a Properties collection. The properties found in this collection for Visual Basic and Visual C# projects are described in the table below.

The ConfigurationManager Object tracks the information related to all defined build configurations. In the general extensibility model, configurations may be defined for projects and for individual project items, so that both the Project Object and the ProjectItem Object have the ConfigurationManager Property (General Extensibility). In the case of Visual Basic and Visual C# projects, configurations are not defined on project items, so the ProjectItem.ConfigurationManager property always returns Nothing.

AllowUnsafeBlocks PropertyAllows code using the unsafe keyword to compile.
BaseAddress PropertySpecifies the base address at which to load a DLL.
CheckForOverflowUnderflow PropertySpecifies whether integer overflow or underflow will cause a run-time exception.
ConfigurationOverrideFile PropertySpecifies which .config file is deployed with a configuration.
DebugSymbols PropertyControls the creation of debug information in the output by the compiler.
DefineConstants PropertyDefines conditional compilation constants.
DefineDebug PropertyDefines and undefines the DEBUG compilation constant.
DefineTrace PropertyDefines and undefines the TRACE compilation constant.
DocumentationFile PropertySpecifies the XML output file that contains the comments from the source code files.
EnableASPDebugging PropertyEnables debugging of .asp files in the project.
EnableASPXDebugging PropertyEnables debugging of .aspx, .asmx, and .asax files in the project.
EnableSQLServerDebugging PropertyEnables SQL Server debugging.
EnableUnmanagedDebugging PropertyEnables debugging of unmanaged code.
FileAlignment PropertySpecifies the size of sections in the output file.
IncrementalBuild PropertyEnables incremental compilation, where only functions that changed since the last compilation are recompiled.
IntermediatePath PropertySpecifies the scratch space directory used by the project system and compiler.
Optimize PropertyDirects the compiler to optimize the output.
OutputPath PropertySpecifies the path for the output files.
RemoteDebugEnabled PropertyEnables debugging on a remote computer.
RemoteDebugMachine PropertySpecifies the name of the computer where the remote executable file resides.
RemoveIntegerChecks PropertySpecifies whether integer arithmetic errors result in exceptions at run time.
RegisterForComInterop PropertyIndicates whether the application exposes a COM object.
StartAction PropertyIndicates the type of item to start when the application is debugged.
StartArguments PropertySpecifies the command-line arguments.
StartPage PropertySpecifies the file that is the start page when a Web application is run if the StartAction property indicates starting a project that is a Web application.
StartProgram PropertySpecifies the external program to start if the StartAction property indicates starting an external program.
StartURL PropertySpecifies the URL to start if the StartAction property indicates starting with a URL.
StartWithIE PropertyIndicates that Internet Explorer should be used to start the project during debugging.
StartWorkingDirectory PropertySpecifies the working directory of the program being debugged.
TreatWarningsAsErrors PropertyIndicates whether warnings are treated as errors.
WarningLevel PropertySpecifies the types of warnings reported during compilation.


Namespace: VSLangProj

File: VSLangProj.dll


The properties available in the Properties collection of the Project object are defined by the ProjectProperties interface. The ProjectConfigurationProperties interface of the VSLangProj namespace is used by the project system to provide the properties to the Properties collection of the Configuration Object. There is no direct programmatic access to the properties through the ProjectConfigurationProperties interface.


To retrieve a particular property, you can use the property name as the index into the Properties.Item method of the Configuration object. You can also pass a 1-based index to the Properties.Item method.

' Macro editor
' Displays the Optimize property in the first configuration
' of the first project.
Sub DisplayOptimizeProperty()
   Dim proj As Project = DTE.Solution.Projects.Item(1)
   ' The namespace is added, since both the System and EnvDTE
   ' namespaces have a Configuration object.
   Dim config As EnvDTE.Configuration
   config = proj.ConfigurationManager.Item(1)
   Dim optimizeOn As Boolean = _
      CType(config.Properties.Item("Optimize").Value, Boolean)
   MsgBox("Optimize is on? " & optimizeOn.ToString())
End Sub

This example displays all the configuration properties.

' Macro Editor
' List the configuration properties for projects and project items.
Sub ListConfigurationProperties()
   Dim pro As Project
   Dim pi As EnvDTE.ProjectItem
   Dim proList As String
   Dim piList As String
   Dim conf As EnvDTE.Configuration
   Dim piconf As EnvDTE.Configuration
   Dim prop As EnvDTE.Property

   For Each pro In DTE.Solution.Projects
      proList = pro.Name & ControlChars.CrLf
      For Each conf In pro.ConfigurationManager
         proList = pro.Name & ControlChars.CrLf _
             & conf.ConfigurationName & ", " & conf.PlatformName _
             & ControlChars.CrLf
         ' List the properties of each configuration.
         For Each prop In conf.Properties
            proList &= prop.Name & " " & prop.Value.ToString() _
               & ControlChars.CrLf
      ' Note that no output is ever displayed here, because the 
      ' ConfigurationManager property is always Nothing for Visual Basic
      ' and Visual C# projects.
      For Each pi In pro.ProjectItems
         piList = pi.Name
         If pi.ConfigurationManager Is Nothing Then
            For Each conf In pi.ConfigurationManager
               piList &= conf.ConfigurationName & ControlChars.CrLf
         End If
End Sub

See Also

C# Compiler Options | Visual Basic Compiler Options | Setting Visual C# Project Properties | Modifying Project Properties and Configuration Settings | VSLangProj Hierarchy Chart