Update SDK to preview7 (#12682)

- react to SDK changes (Microsoft.NETCore.App.Ref assemblies grouping)
- update `dotnet new -u` logic
This commit is contained in:
John Luo 2019-07-29 10:06:07 -07:00 committed by Doug Bunting
parent e2d57e2806
commit 4debc9c455
3 changed files with 36 additions and 10 deletions

View File

@ -1,9 +1,9 @@
{ {
"sdk": { "sdk": {
"version": "3.0.100-preview6-012264" "version": "3.0.100-preview7-012821"
}, },
"tools": { "tools": {
"dotnet": "3.0.100-preview6-012264", "dotnet": "3.0.100-preview7-012821",
"runtimes": { "runtimes": {
"dotnet/x64": [ "dotnet/x64": [
"$(MicrosoftNETCoreAppRuntimeVersion)" "$(MicrosoftNETCoreAppRuntimeVersion)"

View File

@ -108,7 +108,7 @@ This package is an internal implementation of the .NET Core SDK and is not meant
Include="@(ReferencePathWithRefAssemblies)" Include="@(ReferencePathWithRefAssemblies)"
Exclude=" Exclude="
@(_SelectedExtensionsRefAssemblies); @(_SelectedExtensionsRefAssemblies);
@(ReferencePathWithRefAssemblies->WithMetadataValue('NuGetPackageId', 'Microsoft.NETCore.App')); @(ReferencePathWithRefAssemblies->WithMetadataValue('NuGetPackageId', 'Microsoft.NETCore.App.Ref'));
@(ReferencePathWithRefAssemblies->WithMetadataValue('ReferenceGrouping', 'Microsoft.NETCore.App'));" /> @(ReferencePathWithRefAssemblies->WithMetadataValue('ReferenceGrouping', 'Microsoft.NETCore.App'));" />
<AspNetCoreReferenceAssemblyPath <AspNetCoreReferenceAssemblyPath

View File

@ -2,6 +2,7 @@
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System; using System;
using System.Diagnostics;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using System.Reflection; using System.Reflection;
@ -30,10 +31,10 @@ namespace Templates.Test.Helpers
"Microsoft.DotNet.Web.ProjectTemplates.2.1", "Microsoft.DotNet.Web.ProjectTemplates.2.1",
"Microsoft.DotNet.Web.ProjectTemplates.2.2", "Microsoft.DotNet.Web.ProjectTemplates.2.2",
"Microsoft.DotNet.Web.ProjectTemplates.3.0", "Microsoft.DotNet.Web.ProjectTemplates.3.0",
"Microsoft.DotNet.Web.Spa.ProjectTemplates",
"Microsoft.DotNet.Web.Spa.ProjectTemplates.2.1", "Microsoft.DotNet.Web.Spa.ProjectTemplates.2.1",
"Microsoft.DotNet.Web.Spa.ProjectTemplates.2.2", "Microsoft.DotNet.Web.Spa.ProjectTemplates.2.2",
"Microsoft.DotNet.Web.Spa.ProjectTemplates.3.0" "Microsoft.DotNet.Web.Spa.ProjectTemplates.3.0",
"Microsoft.DotNet.Web.Spa.ProjectTemplates"
}; };
public static string CustomHivePath { get; } = typeof(TemplatePackageInstaller) public static string CustomHivePath { get; } = typeof(TemplatePackageInstaller)
@ -85,13 +86,38 @@ namespace Templates.Test.Helpers
Assert.Equal(4, builtPackages.Length); Assert.Equal(4, builtPackages.Length);
/*
* The templates are indexed by path, for example:
&USERPROFILE%\.templateengine\dotnetcli\v3.0.100-preview7-012821\packages\nunit3.dotnetnew.template.1.6.1.nupkg
Templates:
NUnit 3 Test Project (nunit) C#
NUnit 3 Test Item (nunit-test) C#
NUnit 3 Test Project (nunit) F#
NUnit 3 Test Item (nunit-test) F#
NUnit 3 Test Project (nunit) VB
NUnit 3 Test Item (nunit-test) VB
Uninstall Command:
dotnet new -u &USERPROFILE%\.templateengine\dotnetcli\v3.0.100-preview7-012821\packages\nunit3.dotnetnew.template.1.6.1.nupkg
* We don't want to construct this path so we'll rely on dotnet new --uninstall --help to construct the uninstall command.
*/
var proc = await RunDotNetNew(output, "--uninstall --help");
var lines = proc.Output.Split(Environment.NewLine);
// Remove any previous or prebundled version of the template packages // Remove any previous or prebundled version of the template packages
foreach (var packageName in _templatePackages) foreach (var packageName in _templatePackages)
{ {
// We don't need this command to succeed, because we'll verify next that // Depending on the ordering, there may be multiple matches:
// uninstallation had the desired effect. This command is expected to fail // Microsoft.DotNet.Web.Spa.ProjectTemplates.3.0.3.0.0-preview7.*.nupkg
// in the case where the package wasn't previously installed. // Microsoft.DotNet.Web.Spa.ProjectTemplates.3.0.0-preview7.*.nupkg
await RunDotNetNew(output, $"--uninstall {packageName}"); // Error on the side of caution and uninstall all of them
foreach (var command in lines.Where(l => l.Contains("dotnet new") && l.Contains(packageName, StringComparison.OrdinalIgnoreCase)))
{
var uninstallCommand = command.TrimStart();
Debug.Assert(uninstallCommand.StartsWith("dotnet new"));
uninstallCommand = uninstallCommand.Substring("dotnet new".Length);
await RunDotNetNew(output, uninstallCommand);
}
} }
await VerifyCannotFindTemplateAsync(output, "web"); await VerifyCannotFindTemplateAsync(output, "web");
@ -132,7 +158,7 @@ namespace Templates.Test.Helpers
{ {
var proc = await RunDotNetNew(output, $"\"{templateName}\""); var proc = await RunDotNetNew(output, $"\"{templateName}\"");
if (!proc.Error.Contains($"No templates matched the input template name: {templateName}.")) if (!proc.Output.Contains("Couldn't find an installed template that matches the input, searching online for one that does..."))
{ {
throw new InvalidOperationException($"Failed to uninstall previous templates. The template '{templateName}' could still be found."); throw new InvalidOperationException($"Failed to uninstall previous templates. The template '{templateName}' could still be found.");
} }