Ensure test apps use the same SDK as Razor

This commit is contained in:
Pranav K 2017-12-20 16:21:14 -08:00
parent 14fc427068
commit bd03c16ee7
1 changed files with 13 additions and 0 deletions

View File

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