From bd03c16ee7ccd8efbea1dff0afbb9043c137694d Mon Sep 17 00:00:00 2001 From: Pranav K Date: Wed, 20 Dec 2017 16:21:14 -0800 Subject: [PATCH] Ensure test apps use the same SDK as Razor --- .../IntegrationTests/ProjectDirectory.cs | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/test/Microsoft.AspNetCore.Razor.Design.Test/IntegrationTests/ProjectDirectory.cs b/test/Microsoft.AspNetCore.Razor.Design.Test/IntegrationTests/ProjectDirectory.cs index 2f462313cf..02f7efbf07 100644 --- a/test/Microsoft.AspNetCore.Razor.Design.Test/IntegrationTests/ProjectDirectory.cs +++ b/test/Microsoft.AspNetCore.Razor.Design.Test/IntegrationTests/ProjectDirectory.cs @@ -50,6 +50,7 @@ namespace Microsoft.AspNetCore.Razor.Design.IntegrationTests CreateDirectoryProps(projectRoot, binariesRoot, destinationPath); CreateDirectoryTargets(destinationPath); + CopyGlobalJson(solutionRoot, destinationPath); return new ProjectDirectory(destinationPath); } @@ -112,6 +113,18 @@ namespace Microsoft.AspNetCore.Razor.Design.IntegrationTests "; File.WriteAllText(Path.Combine(projectRoot, "Directory.Build.targets"), text); } + + void CopyGlobalJson(string solutionRoot, string projectRoot) + { + var srcGlobalJson = Path.Combine(solutionRoot, "global.json"); + if (!File.Exists(srcGlobalJson)) + { + throw new InvalidOperationException("global.json at the root of the repository could not be found. Run './build /t:Noop' at the repository root and re-run these tests."); + } + + var destinationGlobalJson = Path.Combine(projectRoot, "global.json"); + File.Copy(srcGlobalJson, destinationGlobalJson); + } } private ProjectDirectory(string directoryPath)