Setting Project constants for all configurations

  • Thread starter Thread starter Kevin McNeish [C# MVP]
  • Start date Start date
K

Kevin McNeish [C# MVP]

Does anyone know how to set the project constants property for "All
Configurations" programmatically?

The following code does this by setting each project individually:

foreach (EnvDTE.Configuration config in proj.ConfigurationManager)

{

if
(!mmString.Empty(config.Properties.Item("DefineConstants").Value.ToString())
)

{

// Add a semicolon separator if the DefineConstants property
isn't empty

config.Properties.Item("DefineConstants").Value += ";";

}

config.Properties.Item("DefineConstants").Value += constants;

}


Instead of doing this, I want to set it once for "All Configurations" as I
can do manually through the IDE.
 
Hi Kevin,

Thanks for posting. I am currently doing research on this issue and I will
get back to you as soon as possible.

Have a nice day!

Regards,

Felix Wang
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
 
Hi Kevin,

I am not able to find a better way to achieve this goal as well. The
ConfigurationManager property of the Project only holds separate
configurations. I guess that when we set the properties for "All
Configurations" or "Multiplpe Configurations" within VS.Net IDE, the IDE
achieves the goal by enumearting separate configurations as well.

I hope this helps.

Regards,

Felix Wang
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
 
Back
Top