in src/Analysis/Codelyzer.Analysis.Build/WorkspaceBuilderHelper.cs [478:515]
private EnvironmentOptions GetEnvironmentOptions(bool requiresNetFramework)
{
var os = DetermineOSPlatform();
EnvironmentOptions options = new EnvironmentOptions();
if (os == OSPlatform.Linux || os == OSPlatform.OSX)
{
if (requiresNetFramework)
{
options.EnvironmentVariables.Add(EnvironmentVariables.MSBUILD_EXE_PATH, Constants.MsBuildCommandName);
}
}
try
{
var msbuildExe = GetFrameworkMsBuildExePath();
if (!String.IsNullOrEmpty(msbuildExe)) options.EnvironmentVariables.Add(EnvironmentVariables.MSBUILD_EXE_PATH, msbuildExe);
else { throw new Exception(); }
}
catch(Exception ex)
{
Logger.LogError(ex, "Build error: Codelyzer wasn't able to retrieve the MSBuild path");
}
options.EnvironmentVariables.Add(Constants.EnableNuGetPackageRestore, Boolean.TrueString.ToLower());
options.Arguments.Add(Constants.RestorePackagesConfigArgument);
if (_analyzerConfiguration.MetaDataSettings.GenerateBinFiles)
{
options.GlobalProperties.Add(MsBuildProperties.CopyBuildOutputToOutputDirectory, "true");
options.GlobalProperties.Add(MsBuildProperties.CopyOutputSymbolsToOutputDirectory, "true");
options.GlobalProperties.Add(MsBuildProperties.UseCommonOutputDirectory, "false");
options.GlobalProperties.Add(MsBuildProperties.SkipCopyBuildProduct, "false");
options.GlobalProperties.Add(MsBuildProperties.SkipCompilerExecution, "false");
}
return options;
}