蛋糕脚本中的MSBuild问题

时间:2018-01-03 18:08:50

标签: visual-studio-2017 .net-3.5 cakebuild

我们正在使用cake script v0.18.0编译.net框架(2.0,3.5,4.0,4.5,4.5.1,4.6)项目。

但是,我们在编译3.5框架项目时遇到了以下问题

MSBUILD:错误MSB4025:无法加载项目文件。缺少根元素。

机器规格:

1.VS 2017专业人士

2.SDK 10

3..Net core 2.0.3

MSBuild汇编蛋糕脚本代码:

// Use MSBuild    
        MSBuild(projectFilePath, settings =>
            settings.SetConfiguration(configuration).
            WithProperty("referencepath" , refPath).
            SetVerbosity(Verbosity.Minimal).
            SetNoConsoleLogger(true).
            WithProperty("PreBuildEvent" , "").
            AddFileLogger(new MSBuildFileLogger { LogFile = "../cireports/warnings/"+ filename +".txt",  MSBuildFileLoggerOutput = MSBuildFileLoggerOutput.WarningsOnly }).
            AddFileLogger(new MSBuildFileLogger { LogFile = "../cireports/errorlogs/"+ filename +".txt", MSBuildFileLoggerOutput = MSBuildFileLoggerOutput.ErrorsOnly}).
            WithProperty("CodeAnalysisRuleSet","\""+sourcedirInfo.FullName +@"\FxCop.ruleset"+"\"").
            WithProperty("StyleCopOverrideSettingsFile","\""+sourcedirInfo.FullName+@"\settings.StyleCop"+"\"").
            //UseToolVersion(toolsVersion).             
            WithProperty("OutputPath" , projoutputpath)); 

            //Deletes the empty error log file.
            if(FileExists("../cireports/errorlogs/"+ filename +".txt"))
                DeleteFile("../cireports/errorlogs/"+ filename +".txt");
            if(FileExists("../cireports/warnings/"+ filename +".txt"))
            {
                var streamReader = new System.IO.StreamReader("../cireports/warnings/"+ filename +".txt");
                var warnings = (streamReader.ReadToEnd()).Split('\r');
                streamReader.Dispose();
                if (warnings.Length-1 <= 0)
                //Deletes the empty warning log file.
                DeleteFile("../cireports/warnings/"+ filename +".txt");
                //Displays the errors & warnings count in console log.
                Information("\r\nCompilation result: {0} Error(s) {1} Warning(s)\r\n", 0, warnings.Length-1);
            }

0 个答案:

没有答案
相关问题