Quantcast
Channel: Visual Studio Integrate forum
Viewing all articles
Browse latest Browse all 4410

Parse custom build rules from Visual Studio C++ project

$
0
0

I am currently working on a project to completely revamp the classic "MakeItSo" tool to generate makefiles from a Visual Studio 2010 solution. I am updating it to work with Visual Studio 2015, but it features a different VCProjectEngine whose API is slightly different.

I am trying to extract the custom build rules for each configuration programmatically:

using Microsoft.VisualStudio.VCProjectEngine;/// <summary>/// Parses one configuration for a custom build rule./// </summary>privatevoid parseCustomBuildRule_Configuration(VCFileConfiguration configuration,string relativePath){// We find the custom build rule for this configuration (if there is one)...IVCRulePropertyStorage rule = configuration.ToolasIVCRulePropertyStorage;if(rule ==null)return;// We will store info about this rule in a CustomBuildRuleInfo_CPP object...CustomBuildRule ruleInfo =newCustomBuildRule(); ruleInfo.RelativePathToFile= relativePath;// There is a custom build rule, so we parse it... ruleInfo.RuleName= rule.GetEvaluatedPropertyValue("Name");string commandLine = rule.GetEvaluatedPropertyValue("CommandLine");

...

Unfortunately, rule.GetEvaluatedPropertyValue("Name") is throwing an exception stating that the property cannot be found. GetUnevaluatedPropertyValue("Name") throws the same error. Even the "CommandLine" property throws an error.

Any ideas how to solve this?


Viewing all articles
Browse latest Browse all 4410

Trending Articles