Execute 'csc' with working directory set to the project directory.

When using a ruleset with a relative path in buildOptions, csc can't
find the file because it is not working in the same directory as the
project.

Fix #2710
This commit is contained in:
Eric Erhardt 2016-04-29 22:19:35 -05:00
parent 2827ef208a
commit f2d917ed2e
10 changed files with 99 additions and 7 deletions

View file

@ -43,6 +43,26 @@ namespace Microsoft.DotNet.Tools.Builder.Tests
.Pass();
}
[Fact]
public void It_builds_projects_with_ruleset_relative_path()
{
var testInstance = TestAssetsManager
.CreateTestInstance("TestRuleSet")
.WithLockFiles();
new BuildCommand(Path.Combine("TestLibraryWithRuleSet", "project.json"), skipLoadProject: true)
.WithWorkingDirectory(testInstance.TestRoot)
.ExecuteWithCapturedOutput()
.Should()
.Pass()
.And
.HaveStdErrContaining("CA1001")
.And
.HaveStdErrContaining("CA2213")
.And
.NotHaveStdErrContaining("CA1018"); // this violation is hidden in the ruleset
}
[Fact]
public void It_builds_projects_with_a_local_project_json_path()
{