Merge pull request #2717 from eerhardt/Spaces

dotnet build fails with xmlDoc = true and spaces in the path.
This commit is contained in:
Eric Erhardt 2016-04-27 20:36:36 -05:00
commit a9621eb469
6 changed files with 69 additions and 3 deletions

View file

@ -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
{
/// <summary>
/// Gets the message from the helper. This comment is here to help test XML documentation file generation, please do not remove it.
/// </summary>
/// <returns>A message</returns>
public static string GetMessage()
{
return "This string came from the test library!";
}
public static void SayHi()
{
Console.WriteLine("Hello there!");
}
}
}

View file

@ -0,0 +1,12 @@
{
"version": "1.0.0-*",
"compilationOptions": {
"xmlDoc": true
},
"dependencies": {
"NETStandard.Library": "1.5.0-rc2-24027"
},
"frameworks": {
"netstandard1.5": {}
}
}

View file

@ -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)

View file

@ -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;

View file

@ -22,7 +22,7 @@ namespace Microsoft.DotNet.Tools.Builder.Tests
var buildCommand = new BuildCommand("");
buildCommand.WorkingDirectory = testProjectDirectory;
buildCommand.ExecuteWithCapturedOutput()
.Should()
.Pass();
@ -42,5 +42,29 @@ namespace Microsoft.DotNet.Tools.Builder.Tests
.Should()
.Pass();
}
[Fact]
public void It_builds_projects_with_xmlDoc_and_spaces_in_the_path()
{
var testInstance = TestAssetsManager
.CreateTestInstance("TestLibraryWithXmlDoc", identifier: "With Space")
.WithLockFiles();
testInstance.TestRoot.Should().Contain(" ");
var output = new DirectoryInfo(Path.Combine(testInstance.TestRoot, "output"));
new BuildCommand("", output: output.FullName, framework: DefaultLibraryFramework)
.WithWorkingDirectory(testInstance.TestRoot)
.ExecuteWithCapturedOutput()
.Should()
.Pass();
output.Should().HaveFiles(new[]
{
"TestLibraryWithXmlDoc.dll",
"TestLibraryWithXmlDoc.xml"
});
}
}
}