DefineConstants Property for VS.NET 2003 Macro

  • Thread starter Thread starter ME
  • Start date Start date
You can define the conditional compilation constants by calling the menu
item Project/Properties and then select Configuration Properties.
 
Yes, but I need to do this programatically by the use of a macro (as the
example showed). I have several projects and would like to easily turn a
particular constant on and off for all projects. A toolbar button
refrencing a macro is the plan.

Thanks,

Matt
 
Ah, I see. Instead of Item("DefineConstants") try to use the
ProjectConfigurationProperties.DefineConstants (don't forget to add
reference to VSLangProj):

Sub DefineConstantExample()
Dim solution As EnvDTE.Solution = DTE.Solution

For Each project As EnvDTE.Project In solution
Dim conf As EnvDTE.Configuration
For Each conf In project.ConfigurationManager
Dim p As VSLangProj.ProjectConfigurationProperties = conf.Object
p.DefineConstants = "YourConstant"
Next
Exit Sub
Next
End Sub

It sets "YourConstants" compilation constant through all projects in the
solution.
 
Back
Top