diff --git a/test/Microsoft.Build.Sql.Tests/BuildTests.cs b/test/Microsoft.Build.Sql.Tests/BuildTests.cs index 9b3eb47..ff344e0 100644 --- a/test/Microsoft.Build.Sql.Tests/BuildTests.cs +++ b/test/Microsoft.Build.Sql.Tests/BuildTests.cs @@ -203,7 +203,7 @@ public void VerifyBuildFailureWithUnresolvedReference() public void VerifyBuildWithProjectReference() { // We will copy the ReferenceProj to a temp folder and then add it as project reference - string tempFolder = Path.Combine(Path.GetTempPath(), TestContext.CurrentContext.Test.Name); + string tempFolder = TestUtils.CreateTempDirectory(); TestUtils.CopyDirectoryRecursive(Path.Combine(this.CommonTestDataDirectory, "ReferenceProj"), tempFolder); this.AddProjectReference(Path.Combine(tempFolder, "ReferenceProj.sqlproj")); diff --git a/test/Microsoft.Build.Sql.Tests/DotnetTestBase.cs b/test/Microsoft.Build.Sql.Tests/DotnetTestBase.cs index d2d1e80..12bb3ae 100644 --- a/test/Microsoft.Build.Sql.Tests/DotnetTestBase.cs +++ b/test/Microsoft.Build.Sql.Tests/DotnetTestBase.cs @@ -136,7 +136,7 @@ protected int RunDotnetCommandOnProject(string dotnetCommand, out string stdOutp ProcessStartInfo dotnetStartInfo = new ProcessStartInfo { FileName = TestUtils.GetDotnetPath(), - Arguments = $"{dotnetCommand} {DatabaseProjectName}.sqlproj {arguments}", + Arguments = $"{dotnetCommand} {DatabaseProjectName}.sqlproj {arguments} -v n", WorkingDirectory = this.WorkingDirectory, WindowStyle = ProcessWindowStyle.Hidden, RedirectStandardOutput = true, diff --git a/test/Microsoft.Build.Sql.Tests/TestUtils.cs b/test/Microsoft.Build.Sql.Tests/TestUtils.cs index b9b6c42..2ab2455 100644 --- a/test/Microsoft.Build.Sql.Tests/TestUtils.cs +++ b/test/Microsoft.Build.Sql.Tests/TestUtils.cs @@ -78,5 +78,15 @@ public static string EscapeTestName(string testName) { return testName.Replace("\"", "_"); } + + /// + /// Creates and returns the path to a temporary directory in the current directory. + /// + public static string CreateTempDirectory() + { + string tempDir = Path.Combine(Directory.GetCurrentDirectory(), Path.GetRandomFileName()); + Directory.CreateDirectory(tempDir); + return tempDir; + } } }