1

I am looking for a method (macro/plugin/extension) to change values in a specific property sheet (which is loaded into every project in the solution) without having to reload the solution. Is there a way to access it from a macro or plugin code?

Thanks!

Mark S
  • 235
  • 3
  • 11

2 Answers2

0

Record a macro when you edit the property sheet and view it's code from the macros IDE. Afterwards you could assign key bindings to it and playback anytime.

Soundararajan
  • 1,756
  • 18
  • 22
  • The macro doesn't record the property sheet selection, nor does it record the changes inside the property sheet. All I get is DTE.Windows.Item("{DE1FC918-F32E-4DD7-A915-1792A051F26B}").Activate, which activates the property manager and doesnt work when re-playing. Next is DTE.ExecuteCommand("View.PropertyPages") which opens the currently selected property page – Mark S Feb 04 '13 at 14:21
  • Which property sheet is it ? Is it a standard Visual studio Property sheet ? I was wondering if we could try changing the underlying Model than the View. – Soundararajan Feb 05 '13 at 06:11
  • Perhaps this might help ? http://blogs.msdn.com/b/visualstudio/archive/2010/01/15/how-to-read-write-the-new-visual-c-project-properties.aspx – Soundararajan Feb 05 '13 at 06:57
0

This is how I got to work. And you have to add the VCEngine reference with your project.

VCProject project;
Projects projCollection = sol1.Projects;
project = (VCProject)projCollection.Item(1).Object;
VCConfiguration config = project.Configurations.Item("Test Release|Win32");
IVCRulePropertyStorage rule = config.Rules.Item("ConfigurationDirectories") as IVCRulePropertyStorage;

//Setting the Include directories
string rawValue = rule.GetUnevaluatedPropertyValue("IncludePath");
string evaluatedValue = rule.GetEvaluatedPropertyValue("IncludePath");
rule.SetPropertyValue("IncludePath", "Whatever you like to specify here");
//Setting the Executable Directory
rawValue = rule.GetUnevaluatedPropertyValue("ExecutablePath");
rule.SetPropertyValue("ExecutablePath", "Whatever you like to specify here");