I try to make an extension for VisualStudio 2017.
Currently, I don't find a mean to translate the $(XXX) (by example $(SolutionDir) or $(TargetName)) programmatically using C# and Visual.VCProject API.
EnvDTE.Project project = (EnvDTE.Project)selectedProjects.GetValue(0);
var vcproj = project.Object as VCProject;
VCConfiguration cfg = (VCConfiguration)vcproj.ActiveConfiguration;
VCDebugSettings debug = (VCDebugSettings)cfg.DebugSettings;
string path = debug.WorkingDirectory;
// Here path is $(ProjectDir) But I need something like c:\myProject
// Resolution can be done because Visual can do: my question is : How ?
Do you have some ideas to do that ?
References & doc:
EDIT: After some search
I found some explain in doc about $()
May be reply is inside this part of doc ?
https://learn.microsoft.com/fr-fr/visualstudio/extensibility/internals/using-msbuild
Use VCConfiguration.Evaluate to valuate the value of a project model or environment macro
EnvDTE.Project project = (EnvDTE.Project)selectedProjects.GetValue(0);
var vcproj = project.Object as VCProject;
VCConfiguration cfg = (VCConfiguration)vcproj.ActiveConfiguration;
VCDebugSettings debug = (VCDebugSettings)cfg.DebugSettings;
//string path = debug.WorkingDirectory;
string path = cfg.Evaluate(debug.WorkingDirectory);
// Here path is $(ProjectDir) But I need something like c:\myProject
// Resolution can be done because Visual can do: my question is : How ?