示例#1
0
        private CompileResult CompileWithMSBuild()
        {
            string msBuildPath = _visualStudioFinder.FindMSBuild();

            _outputWriter.WriteLine($"Invoke MsBuild from {msBuildPath}");

            var processHelper  = new ProcessHelper();
            var msBuildProcess = processHelper.RunProcess(_outputWriter, _testProjectFolders.PathToSolutionDirectory, msBuildPath, $"-restore -bl -nologo -v:m \"{_testProjectFolders.PathToSolutionFile}\"");

            return(new CompileResult(msBuildProcess.ExitCode, msBuildProcess.CombinedOutput));
        }
示例#2
0
        private CompileResult CompileWithMSBuild(bool?treatWarningsAsErrors)
        {
            string msBuildPath = "";

            if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
            {
                msBuildPath = _visualStudioFinder.FindMSBuild();
            }
            else
            {
                msBuildPath = "msbuild";
            }

            _outputWriter.WriteLine($"Invoke MsBuild from {msBuildPath}");

            var    processHelper   = new ProcessHelper();
            string argumentsFormat = $"{GetWarningAsErrorParameter(treatWarningsAsErrors)} -restore -binaryLogger:;ProjectImports=None -nodeReuse:false -v:m \"{_testProjectFolders.PathToSolutionFile}\"";

            var msBuildProcess = processHelper.RunProcess(_outputWriter, _testProjectFolders.PathToSolutionDirectory, msBuildPath, argumentsFormat);

            return(new CompileResult(msBuildProcess.ExitCode, msBuildProcess.CombinedOutput));
        }