Msbuild不支持多线程解决方案构建 [英] Msbuild not supporting multi thread solution build

查看:87
本文介绍了Msbuild不支持多线程解决方案构建的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一种情况是在多线程中使用MSBUILD构建多个解决方案,但在构建期间,总是很少有解决方案失败。我尝试逐个构建每个解决方案,它的工作完美。但我尝试使用多线程构建5解决方案,很少生成失败。当我调查成功构建和失败构建的构建日志文件时,似乎MSBUILD与每个构建过程发生冲突。作为参考,我附上了两个构建日志的文本文件。



提交ID 11468的构建开始



构建开始提交ID 11468



字符串SolutionPath = System.IO.Directory.GetFiles(SolutionFolder,* .sln)。 FirstOrDefault(); 
WriteLog(A,TimeStartExecute.ElapsedMilliseconds.ToString(),string.Format(构建解决方案名称{0},SolutionPath));
ProjectCollection pc = new ProjectCollection();
Dictionary GlobalProperty = new Dictionary();
GlobalProperty.Add(配置,appConfiguration);
GlobalProperty.Add(平台,appPlatform);
//GlobalProperty.Add(\"Platform,x86);
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,
参数= @Logfile =+ SolutionFolder +\\ build .log
}
};
}
使用(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]);
}
}





我的尝试:



调查后通过构建日志发现构建过程中的问题..



成功构建日志https://github.com/Microsoft/msbuild/files/1115978/11468.success.txt



故障构建日志 https://github.com /Microsoft/msbuild/files/1115979/11468.failed.txt

解决方案

在failed.txt中我可以看到MsBuild在找到时遇到问题CopyArray_Test 并在很多地方进行搜索,直到找到一个你可能不想要的地方。

所以请确保你的路径正确,也许做重建也会有所帮助。 / BLOCKQUOTE>

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("Platform", "x86");
                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

解决方案

In failed.txt I can see that MsBuild has problems finding CopyArray_Test and searches in lot of places until it finds one that you probably did not intend.
So make sure you have got your paths right, and maybe doing a Rebuild will help too.


这篇关于Msbuild不支持多线程解决方案构建的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆