diff --git a/build/dependencies.props b/build/dependencies.props index b2b46071a1..8e7e3b96f0 100644 --- a/build/dependencies.props +++ b/build/dependencies.props @@ -41,12 +41,12 @@ 2.2.0-preview1-34410 2.2.0-preview1-34410 2.0.3 - 0.19.0 - 3.7.0 - 16.16299.0 - 3.7.0 + 0.20.0 + 3.12.1 + 17.17134.0 + 3.12.1 4.6.0-preview1-26604-01 - 0.8.0 + 0.9.0 2.3.1 2.4.0-beta.1.build3945 diff --git a/test/Templates.Test/Helpers/TemplatePackageInstaller.cs b/test/Templates.Test/Helpers/TemplatePackageInstaller.cs index 1361d7fcd9..a76bceb599 100644 --- a/test/Templates.Test/Helpers/TemplatePackageInstaller.cs +++ b/test/Templates.Test/Helpers/TemplatePackageInstaller.cs @@ -1,4 +1,7 @@ -using System; +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using System; using System.IO; using System.Linq; using Microsoft.Extensions.CommandLineUtils; @@ -22,19 +25,25 @@ namespace Templates.Test.Helpers "Microsoft.DotNet.Web.Spa.ProjectTemplates", }; - public static void EnsureTemplatePackagesWereReinstalled(ITestOutputHelper output) + public static string CustomHivePath { get; } = Path.Combine(AppContext.BaseDirectory, ".templateengine"); + + public static void EnsureTemplatingEngineInitialized(ITestOutputHelper output) { lock (_templatePackagesReinstallationLock) { if (!_haveReinstalledTemplatePackages) { - ReinstallTemplatePackages(output); + if (Directory.Exists(CustomHivePath)) + { + Directory.Delete(CustomHivePath, recursive: true); + } + InstallTemplatePackages(output); _haveReinstalledTemplatePackages = true; } } } - private static void ReinstallTemplatePackages(ITestOutputHelper output) + private static void InstallTemplatePackages(ITestOutputHelper output) { // Remove any previous or prebundled version of the template packages foreach (var packageName in _templatePackages) @@ -43,7 +52,7 @@ namespace Templates.Test.Helpers output, AppContext.BaseDirectory, DotNetMuxer.MuxerPathOrDefault(), - $"new --uninstall {packageName}"); + $"new --uninstall {packageName} --debug:custom-hive \"{CustomHivePath}\""); // We don't need this command to succeed, because we'll verify next that // uninstallation had the desired effect. This command is expected to fail @@ -66,7 +75,7 @@ namespace Templates.Test.Helpers output, AppContext.BaseDirectory, DotNetMuxer.MuxerPathOrDefault(), - $"new --install \"{packagePath}\""); + $"new --install \"{packagePath}\" --debug:custom-hive \"{CustomHivePath}\""); proc.WaitForExit(assertSuccess: true); } } @@ -84,7 +93,7 @@ namespace Templates.Test.Helpers output, tempDir, DotNetMuxer.MuxerPathOrDefault(), - $"new \"{templateName}\""); + $"new \"{templateName}\" --debug:custom-hive \"{CustomHivePath}\""); proc.WaitForExit(assertSuccess: false); diff --git a/test/Templates.Test/Helpers/TemplateTestBase.cs b/test/Templates.Test/Helpers/TemplateTestBase.cs index 449fa3151f..42fe95469c 100644 --- a/test/Templates.Test/Helpers/TemplateTestBase.cs +++ b/test/Templates.Test/Helpers/TemplateTestBase.cs @@ -25,7 +25,7 @@ namespace Templates.Test public TemplateTestBase(ITestOutputHelper output) { - TemplatePackageInstaller.EnsureTemplatePackagesWereReinstalled(output); + TemplatePackageInstaller.EnsureTemplatingEngineInitialized(output); Output = output; ProjectGuid = Guid.NewGuid().ToString("N"); @@ -57,16 +57,11 @@ $@" File.WriteAllText(Path.Combine(TemplateOutputDir, "Directory.Build.targets"), directoryBuildTargetsContent); } - protected void InstallTemplatePackages() - { - throw new NotImplementedException(); - } - protected void RunDotNetNew(string templateName, string targetFrameworkOverride, string auth = null, string language = null, bool useLocalDB = false, bool noHttps = false) { SetAfterDirectoryBuildPropsContents(); - var args = $"new {templateName}"; + var args = $"new {templateName} --debug:custom-hive \"{TemplatePackageInstaller.CustomHivePath}\""; if (!string.IsNullOrEmpty(targetFrameworkOverride)) {