.net - Building C++ Solution using MSBuild within C# Appliction -


i'm trying use microsoft.build.execution.buildmanager build c++ solution within c# winforms application.

from other posts i've come following code, uses logger can see output. buildsubmission.buildresult.overallresult failure when trying build c++ application.

string projectfilename = "mysolution.sln"; projectcollection pc = new projectcollection(); dictionary<string, string> globalproperty = new dictionary<string, string>(); globalproperty.add("configuration", "release"); globalproperty.add("platform", "win32");  buildparameters bp = new buildparameters(pc); bp.loggers = new[] {                       new consolelogger                       {                         verbosity = loggerverbosity.minimal,                         showsummary = true,                         skipprojectstartedtext = true                       }                     };  buildmanager.defaultbuildmanager.beginbuild(bp); buildrequestdata buildrequest = new buildrequestdata(projectfilename, globalproperty, null, new string[] { "clean" }, null);  buildsubmission buildsubmission = buildmanager.defaultbuildmanager.pendbuildrequest(buildrequest); buildsubmission.execute(); buildmanager.defaultbuildmanager.endbuild();  if (buildsubmission.buildresult.overallresult == buildresultcode.failure) {     throw new exception(); } 

when run code, following output:

c:\program files (x86)\msbuild\microsoft.cpp\v4.0\v140\microsoft.cppclean.targets(76,5): error msb4127: "cppclean" task not instantiated assembly "c:\program files (x86)\msbuild\microsoft.cpp\v4.0\v140\microsoft.build.cpptasks.common.dll". please verify task assembly has been built using same version of microsoft.build.framework assembly 1 installed on computer , host application not missing binding redirect microsoft.build.framework. unable cast object of type 'microsoft.build.cpptasks.cppclean' type 'microsoft.build.framework.itask'.

c:\program files (x86)\msbuild\microsoft.cpp\v4.0\v140\microsoft.cppclean.targets(76,5): error msb4060: "cppclean" task has been declared or used incorrectly, or failed during construction. check spelling of task name , assembly name.

can explain why i'm getting message how can resolve it?

ps. i'd prefer solutions work updating object/variable in c# code or updates setting in c++ solution involve manually updating msbuild or visual studio files. i'm working in environment multiple developers , prefer not have propagate changes on team application work them.


Comments

Popular posts from this blog

java - nested exception is org.hibernate.exception.SQLGrammarException: could not extract ResultSet Hibernate+SpringMVC -

sql - Postgresql tables exists, but getting "relation does not exist" when querying -

asp.net mvc - breakpoint on javascript in CSHTML? -