-
June 10th, 2011, 09:16 AM
#1
VCBUILD task in C# code
Hi,
Im writting a C# program to automate our builds utilizing the MSBUILD functionality. Alot of our code is written in C++. Does anyone know how to add the VCBUILD task to the engine.BuildProjectFile function? I've added my code snippet to the bottom of this message. I setup a log file to capture build error messages, and I get the following :
Build started 6/9/2011 5:01:14 PM.
__________________________________________________
Project "D:\Manitou\Releases\1.6.0\Fixes_1.6.0\Tapi\Boldphone\Boldphone.sln" (Build target(s)):
Target ValidateSolutionConfiguration:
Building solution configuration "Release|Win32".
Target Build:
Target Boldphone:
D:\Manitou\Releases\1.6.0\Fixes_1.6.0\Tapi\Boldphone\Boldphone.sln.cache(104,5): error MSB4036: The "VCBuild" task was not found. Check the following: 1.) The name of the task in the project file is the same as the name of the task class. 2.) The task class is "public" and implements the Microsoft.Build.Framework.ITask interface. 3.) The task is correctly declared with <UsingTask> in the project file, or in the *.tasks files located in the "C:\Windows\Microsoft.NET\Framework\v4.0.30319" directory.
Done building target "Boldphone" in project "Boldphone.sln" -- FAILED.
Done building target "Build" in project "Boldphone.sln" -- FAILED.
Done building project "Boldphone.sln" -- FAILED.
Build FAILED.
D:\Manitou\Releases\1.6.0\Fixes_1.6.0\Tapi\Boldphone\Boldphone.sln.cache(104,5): error MSB4036: The "VCBuild" task was not found. Check the following: 1.) The name of the task in the project file is the same as the name of the task class. 2.) The task class is "public" and implements the Microsoft.Build.Framework.ITask interface. 3.) The task is correctly declared with <UsingTask> in the project file, or in the *.tasks files located in the "C:\Windows\Microsoft.NET\Framework\v4.0.30319" directory.
0 Warning(s)
1 Error(s)
Time Elapsed 00:00:00.06
Here's a code snippet of my code so far:
Code:
BuildPropertyGroup group = new BuildPropertyGroup();
group.SetProperty("Configuration", "Release");
Microsoft.Build.BuildEngine.Engine engine = new Engine();
// Instantiate a new FileLogger to generate build log
FileLogger logger = new FileLogger();
// Set the logfile parameter to indicate the log destination
logger.Parameters = @"logfile=C:\temp\build.log";
// Register the logger with the engine
engine.RegisterLogger(logger);
// Initialize code
Boolean success = engine.BuildProjectFile(@"D:\Manitou\Releases\1.6.0\Fixes_1.6.0\Tapi\Boldphone\Boldphone.sln", new String[] { "Build" }, group);
//Unregister all loggers to close the log file
engine.UnregisterAllLoggers();
if (success)
{
Console.WriteLine("Build succeeded.");
}
else
{
Console.WriteLine(@"Build failed. View C:\temp\build.log for details");
}
Thanks for anyhelp on this!
Larry
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|