I have a situation to build multiple solution using MSBUILD in multi threading, but during build, always few solution get failed. I have try to build each solution one by one , its working perfectly. but i have try to build 5 solution using multi threading, few build get failed. As I investigated the build log file of both success build and failure build, it seems MSBUILD getting conflict with each build process. For reference I have attached two text file of build log.
Build start for submission ID 11468
Build start for submission ID 11468
string SolutionPath = System.IO.Directory.GetFiles(SolutionFolder, "*.sln").FirstOrDefault();
WriteLog("A", TimeStartExecute.ElapsedMilliseconds.ToString(), string.Format("Build solution name {0}", SolutionPath));
ProjectCollection pc = new ProjectCollection();
Dictionary GlobalProperty = new Dictionary();
GlobalProperty.Add("Configuration", appConfiguration);
GlobalProperty.Add("Platform", appPlatform);
GlobalProperty.Add("OutputPath", appOutputPath);
GlobalProperty.Add("VisualStudioVersion", appVSVersion);
GlobalProperty.Add("BuildInParallel", "true");
GlobalProperty.Add("maxcpucount", "2");
BuildParameters bp = new BuildParameters(pc);
if (appBuildLogger.Equals("true"))
{
bp.Loggers = new[]
{
new FileLogger
{
Verbosity = LoggerVerbosity.Detailed,
ShowSummary = true,
SkipProjectStartedText = true,
Parameters=@"Logfile="+SolutionFolder+"\\build.log"
}
};
}
using (BuildManager objBuildManager = new BuildManager())
{
BuildRequestData BuildRequest = new BuildRequestData(SolutionPath, GlobalProperty, "14.0", new string[]
{ "Build" }, null,
BuildRequestDataFlags.ReplaceExistingProjectInstance);
BuildResult buildResult = objBuildManager.Build(bp, BuildRequest)
if (buildResult.OverallResult == BuildResultCode.Success)
{
buildPath = Convert.ToString(buildResult.ResultsByTarget.FirstOrDefault(x =>
x.Key == "Build").Value.Items[0]);
}
}
What I have tried:
After investigation found the problem in build process by build log..
Success build log
https://github.com/Microsoft/msbuild/files/1115978/11468.success.txt
failure build log
https://github.com/Microsoft/msbuild/files/1115979/11468.failed.txt