Skip to content

Commit

Permalink
Fixing pack build for projects with spaces in the path.
Browse files Browse the repository at this point in the history
  • Loading branch information
toddm committed Mar 31, 2016
1 parent 251b035 commit cdcab62
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/NuGet.Clients/NuGet.CommandLine/Commands/ProjectFactory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -367,10 +367,17 @@ private void BuildProjectWithMsbuild()
string properties = string.Empty;
foreach (var property in ProjectProperties)
{
properties += $" /p:{property.Key}={property.Value}";
if (property.Value.Contains(" "))
{
properties += $" /p:{property.Key}=\"{property.Value}\"";
}
else
{
properties += $" /p:{property.Key}={property.Value}";
}
}

int result = MsBuildUtility.Build(_msbuildDirectory, $"{_project.FullPath} {properties} /toolsversion:{_project.ToolsVersion}");
int result = MsBuildUtility.Build(_msbuildDirectory, $"\"{_project.FullPath}\" {properties} /toolsversion:{_project.ToolsVersion}");

if ((int)Microsoft.Build.Execution.BuildResultCode.Failure == result)
{
Expand Down

0 comments on commit cdcab62

Please sign in to comment.