c# - How to compile single c++ file programmatically using Microsoft.Build.Evaluation.Project -


i want compile single c++ file project in visual studio 2012 solution. similar (using msbuild compile single cpp file) using microsoft.build.evaluation.project

for command line can use msbuild <projectfile> /v:q /p:configuration="<configuration>" /p:platform=x64 /t:clcompile /p:selectedfiles="<files separated semicolon>"

i tried following code

microsoft.build.evaluation.project project; string projfile = "c:\\projdir\\projectfile.vcxproj";  dictionary<string, string> props = new dictionary<string, string>(); props.add("configuration", "_64releasedi"); props.add("platform", "x64"); props.add("selectedfiles", "codefile.cpp");  project = new microsoft.build.evaluation.project(projfile, props, "4.0");  mycustombuildlogger logger = new mycustombuildlogger();  bool boutput = project.build(new string[] { "clcompile" }, new mycustombuildlogger[] {logger}); textbox1.text = logger.output; 

but found compile complete project , other projects project depend on.

please provide snippet achieve it.


Comments

Popular posts from this blog

serialization - Convert Any type in scala to Array[Byte] and back -

matplotlib support failed in PyCharm on OSX -

python - Matplotlib: TypeError: 'AxesSubplot' object is not callable -