Skip to content

Commit 4883e12

Browse files
committed
Wrap csproj path in quotes.
1 parent 8f345fb commit 4883e12

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

src/BenchmarkDotNet/Toolchains/DotNetCli/DotNetCliCommand.cs

+8-3
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,8 @@ internal static IEnumerable<string> GetAddPackagesCommands(BuildPartition buildP
159159

160160
internal static string GetRestoreCommand(ArtifactsPaths artifactsPaths, BuildPartition buildPartition, string csProjPath, string? extraArguments = null, string? binLogSuffix = null, bool excludeOutput = false)
161161
=> new StringBuilder()
162-
.AppendArgument($"restore {csProjPath}")
162+
.AppendArgument("restore")
163+
.AppendArgument(string.IsNullOrEmpty(csProjPath) ? string.Empty : $"\"{csProjPath}\"")
163164
.AppendArgument(string.IsNullOrEmpty(artifactsPaths.PackagesDirectoryName) ? string.Empty : $"--packages \"{artifactsPaths.PackagesDirectoryName}\"")
164165
.AppendArgument(GetCustomMsBuildArguments(buildPartition.RepresentativeBenchmarkCase, buildPartition.Resolver))
165166
.AppendArgument(extraArguments)
@@ -170,7 +171,9 @@ internal static string GetRestoreCommand(ArtifactsPaths artifactsPaths, BuildPar
170171

171172
internal static string GetBuildCommand(ArtifactsPaths artifactsPaths, BuildPartition buildPartition, string csProjPath, string? extraArguments = null, string? binLogSuffix = null, bool excludeOutput = false)
172173
=> new StringBuilder()
173-
.AppendArgument($"build {csProjPath} -c {buildPartition.BuildConfiguration}") // we don't need to specify TFM, our auto-generated project contains always single one
174+
.AppendArgument("build")
175+
.AppendArgument(string.IsNullOrEmpty(csProjPath) ? string.Empty : $"\"{csProjPath}\"")
176+
.AppendArgument($"-c {buildPartition.BuildConfiguration}") // we don't need to specify TFM, our auto-generated project contains always single one
174177
.AppendArgument(GetCustomMsBuildArguments(buildPartition.RepresentativeBenchmarkCase, buildPartition.Resolver))
175178
.AppendArgument(extraArguments)
176179
.AppendArgument(GetMandatoryMsBuildSettings(buildPartition.BuildConfiguration))
@@ -181,7 +184,9 @@ internal static string GetBuildCommand(ArtifactsPaths artifactsPaths, BuildParti
181184

182185
internal static string GetPublishCommand(ArtifactsPaths artifactsPaths, BuildPartition buildPartition, string csProjPath, string? extraArguments = null, string? binLogSuffix = null)
183186
=> new StringBuilder()
184-
.AppendArgument($"publish {csProjPath} -c {buildPartition.BuildConfiguration}") // we don't need to specify TFM, our auto-generated project contains always single one
187+
.AppendArgument("publish")
188+
.AppendArgument(string.IsNullOrEmpty(csProjPath) ? string.Empty : $"\"{csProjPath}\"")
189+
.AppendArgument($"-c {buildPartition.BuildConfiguration}") // we don't need to specify TFM, our auto-generated project contains always single one
185190
.AppendArgument(GetCustomMsBuildArguments(buildPartition.RepresentativeBenchmarkCase, buildPartition.Resolver))
186191
.AppendArgument(extraArguments)
187192
.AppendArgument(GetMandatoryMsBuildSettings(buildPartition.BuildConfiguration))

0 commit comments

Comments
 (0)