mirror of
https://github.com/github/codeql.git
synced 2025-12-17 01:03:14 +01:00
Merge pull request #3199 from hvitved/csharp/vsvars-unset-platform
C#: Unset `Platform` env variable when invoking `vcvarsall.bat`
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
@@ -169,7 +169,7 @@ namespace Semmle.Autobuild
|
||||
arguments.Append(" &&");
|
||||
}
|
||||
|
||||
public CommandBuilder RunCommand(string exe, string? argumentsOpt = null)
|
||||
public CommandBuilder RunCommand(string exe, string? argumentsOpt = null, bool quoteExe = true)
|
||||
{
|
||||
var (exe0, arg0) =
|
||||
escapingMode == EscapeMode.Process && exe.EndsWith(".exe", System.StringComparison.Ordinal)
|
||||
@@ -183,7 +183,10 @@ namespace Semmle.Autobuild
|
||||
}
|
||||
else
|
||||
{
|
||||
QuoteArgument(exe0);
|
||||
if (quoteExe)
|
||||
QuoteArgument(exe0);
|
||||
else
|
||||
Argument(exe0);
|
||||
}
|
||||
Argument(arg0);
|
||||
Argument(argumentsOpt);
|
||||
|
||||
@@ -57,7 +57,14 @@ namespace Semmle.Autobuild
|
||||
var command = new CommandBuilder(builder.Actions);
|
||||
|
||||
if (vsTools != null)
|
||||
{
|
||||
command.CallBatFile(vsTools.Path);
|
||||
// `vcvarsall.bat` sets a default Platform environment variable,
|
||||
// which may not be compatible with the supported platforms of the
|
||||
// given project/solution. Unsetting it means that the default platform
|
||||
// of the project/solution is used instead.
|
||||
command.RunCommand("set Platform=&& type NUL", quoteExe: false);
|
||||
}
|
||||
|
||||
builder.MaybeIndex(command, MsBuild);
|
||||
command.QuoteArgument(projectOrSolution.FullPath);
|
||||
|
||||
Reference in New Issue
Block a user