diff --git a/TestAssets/TestProjects/TestLibrary With Spaces/.noautobuild b/TestAssets/TestProjects/TestLibrary With Spaces/.noautobuild
new file mode 100644
index 000000000..e69de29bb
diff --git a/TestAssets/TestProjects/TestLibrary With Spaces/Helper.cs b/TestAssets/TestProjects/TestLibrary With Spaces/Helper.cs
new file mode 100644
index 000000000..8c643796b
--- /dev/null
+++ b/TestAssets/TestProjects/TestLibrary With Spaces/Helper.cs
@@ -0,0 +1,24 @@
+// Copyright (c) .NET Foundation and contributors. All rights reserved.
+// Licensed under the MIT license. See LICENSE file in the project root for full license information.
+
+using System;
+
+namespace TestLibrary
+{
+ public static class Helper
+ {
+ ///
+ /// Gets the message from the helper. This comment is here to help test XML documentation file generation, please do not remove it.
+ ///
+ /// A message
+ public static string GetMessage()
+ {
+ return "This string came from the test library!";
+ }
+
+ public static void SayHi()
+ {
+ Console.WriteLine("Hello there!");
+ }
+ }
+}
diff --git a/TestAssets/TestProjects/TestLibrary With Spaces/project.json b/TestAssets/TestProjects/TestLibrary With Spaces/project.json
new file mode 100644
index 000000000..d3022b01b
--- /dev/null
+++ b/TestAssets/TestProjects/TestLibrary With Spaces/project.json
@@ -0,0 +1,12 @@
+{
+ "version": "1.0.0-*",
+ "compilationOptions": {
+ "xmlDoc": true
+ },
+ "dependencies": {
+ "NETStandard.Library": "1.5.0-rc2-24027"
+ },
+ "frameworks": {
+ "netstandard1.3": {}
+ }
+}
diff --git a/src/dotnet/commands/dotnet-compile-csc/Program.cs b/src/dotnet/commands/dotnet-compile-csc/Program.cs
index 159e892f4..528b8f8b9 100644
--- a/src/dotnet/commands/dotnet-compile-csc/Program.cs
+++ b/src/dotnet/commands/dotnet-compile-csc/Program.cs
@@ -189,7 +189,7 @@ namespace Microsoft.DotNet.Tools.Compiler.Csc
if (options.GenerateXmlDocumentation == true)
{
- commonArgs.Add($"-doc:{Path.ChangeExtension(outputName, "xml")}");
+ commonArgs.Add($"-doc:\"{Path.ChangeExtension(outputName, "xml")}\"");
}
if (options.EmitEntryPoint != true)
diff --git a/test/Microsoft.DotNet.Tools.Tests.Utilities/Commands/TestCommand.cs b/test/Microsoft.DotNet.Tools.Tests.Utilities/Commands/TestCommand.cs
index deb82052e..df396972e 100644
--- a/test/Microsoft.DotNet.Tools.Tests.Utilities/Commands/TestCommand.cs
+++ b/test/Microsoft.DotNet.Tools.Tests.Utilities/Commands/TestCommand.cs
@@ -14,7 +14,7 @@ namespace Microsoft.DotNet.Tools.Test.Utilities
public class TestCommand
{
protected string _command;
-
+
private string _baseDirectory;
public string WorkingDirectory { get; set; }
@@ -33,6 +33,12 @@ namespace Microsoft.DotNet.Tools.Test.Utilities
#endif
}
+ public TestCommand WithWorkingDirectory(string workingDirectory)
+ {
+ WorkingDirectory = workingDirectory;
+ return this;
+ }
+
public virtual CommandResult Execute(string args = "")
{
var commandPath = _command;
diff --git a/test/dotnet-build.Tests/GivenDotnetBuildBuildsProjects.cs b/test/dotnet-build.Tests/GivenDotnetBuildBuildsProjects.cs
index d05471455..6c9802f05 100644
--- a/test/dotnet-build.Tests/GivenDotnetBuildBuildsProjects.cs
+++ b/test/dotnet-build.Tests/GivenDotnetBuildBuildsProjects.cs
@@ -42,5 +42,19 @@ namespace Microsoft.DotNet.Tools.Builder.Tests
.Should()
.Pass();
}
+
+ [Fact]
+ public void It_builds_projects_with_spaces_in_the_path()
+ {
+ var testInstance = TestAssetsManager
+ .CreateTestInstance("TestLibrary With Spaces")
+ .WithLockFiles();
+
+ new BuildCommand("")
+ .WithWorkingDirectory(testInstance.TestRoot)
+ .ExecuteWithCapturedOutput()
+ .Should()
+ .Pass();
+ }
}
}