diff --git a/src/Components/WebAssembly/Build/test/BuildIntegrationTests/ProjectDirectory.cs b/src/Components/WebAssembly/Build/test/BuildIntegrationTests/ProjectDirectory.cs index 97ad1e8bd3f1..d09c0b43148c 100644 --- a/src/Components/WebAssembly/Build/test/BuildIntegrationTests/ProjectDirectory.cs +++ b/src/Components/WebAssembly/Build/test/BuildIntegrationTests/ProjectDirectory.cs @@ -24,7 +24,8 @@ public static readonly string TestProjectConfiguration #error Configuration not supported #endif - private static readonly string RepoRoot = GetTestAttribute("Testing.RepoRoot"); + private static readonly string RepoRoot = string.IsNullOrEmpty(Environment.GetEnvironmentVariable("helix")) + ? GetTestAttribute("Testing.RepoRoot") : Directory.GetCurrentDirectory(); public static ProjectDirectory Create(string projectName, string baseDirectory = "", string[] additionalProjects = null) { @@ -43,7 +44,16 @@ public static ProjectDirectory Create(string projectName, string baseDirectory = throw new InvalidOperationException("RepoRoot was not specified."); } - var testAppsRoot = Path.Combine(RepoRoot, "src", "Components", "WebAssembly", "Build", "testassets"); + var testAppsRoot = string.IsNullOrEmpty(Environment.GetEnvironmentVariable("helix")) + ? Path.Combine(RepoRoot, "src", "Components", "Blazor", "Build", "testassets") + : Directory.GetCurrentDirectory(); + + if (!Directory.Exists(testAppsRoot)) + { + throw new DirectoryNotFoundException("Unable to find testassets in " + + $"{Directory.GetCurrentDirectory()} or {testAppsRoot}."); + } + foreach (var project in new string[] { projectName, }.Concat(additionalProjects ?? Array.Empty())) { var projectRoot = Path.Combine(testAppsRoot, project); @@ -132,7 +142,9 @@ static void SetupDirectoryBuildFiles(string repoRoot, string testAppsRoot, strin static void CopyRepositoryAssets(string projectRoot) { const string GlobalJsonFileName = "global.json"; - var globalJsonPath = Path.Combine(RepoRoot, GlobalJsonFileName); + var path = string.IsNullOrEmpty(Environment.GetEnvironmentVariable("helix")) + ? RepoRoot : Directory.GetCurrentDirectory(); + var globalJsonPath = Path.Combine(path, GlobalJsonFileName); var destinationFile = Path.Combine(projectRoot, GlobalJsonFileName); File.Copy(globalJsonPath, destinationFile); diff --git a/src/Components/WebAssembly/Build/test/Microsoft.AspNetCore.Components.WebAssembly.Build.Tests.csproj b/src/Components/WebAssembly/Build/test/Microsoft.AspNetCore.Components.WebAssembly.Build.Tests.csproj index fd25c908f9cb..9a2a6b97184e 100644 --- a/src/Components/WebAssembly/Build/test/Microsoft.AspNetCore.Components.WebAssembly.Build.Tests.csproj +++ b/src/Components/WebAssembly/Build/test/Microsoft.AspNetCore.Components.WebAssembly.Build.Tests.csproj @@ -5,7 +5,6 @@ $(DefaultItemExcludes);TestFiles\**\* - false false @@ -37,6 +36,14 @@ + + + + + + + + <_Parameter1>Testing.RepoRoot diff --git a/src/Components/WebAssembly/Build/testassets/Directory.Build.props b/src/Components/WebAssembly/Build/testassets/Directory.Build.props index 109d34f2615d..61a4c548c365 100644 --- a/src/Components/WebAssembly/Build/testassets/Directory.Build.props +++ b/src/Components/WebAssembly/Build/testassets/Directory.Build.props @@ -7,7 +7,9 @@ $([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), global.json))\ $(RepoRoot)src\Components\ $(ComponentsRoot)WebAssembly\Build\src\ - $(BlazorBuildRoot)ReferenceBlazorBuildFromSource.props + $(BlazorBuildRoot)ReferenceBlazorBuildFromSource.props + $(MSBuildThisFileDirectory)\..\src\ReferenceBlazorBuildFromSource.props + netcoreapp3.1 @@ -16,15 +18,17 @@ false - + + - + +