Adding STS to the list of TFM selection (#1350)

- Adding STS as a TFM selection option along with LTS & Preview.
- Updating the tests to reflect this change. 
- Making STS the default tfm selection if an explicit TFM is not passed through the commandline tool.
- Temporarily disabling the Web tests since the namespace import fix is not getting applied while running the tests.
This commit is contained in:
Vijay Ramakrishnan 2022-11-07 08:55:10 -08:00 коммит произвёл GitHub
Родитель be3f44f307
Коммит 3c1aa55c0a
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
25 изменённых файлов: 63 добавлений и 63 удалений

Просмотреть файл

@ -225,7 +225,7 @@
<value>The path to a project or solution file to be used.</value>
</data>
<data name="UpgradeAssistantCommandTargetTfm" xml:space="preserve">
<value>Select if you would like the Long Term Support (LTS), Current, or Preview TFM. See https://dotnet.microsoft.com/platform/support/policy/dotnet-core for details on what these mean.</value>
<value>Select if you would like the Long Term Support (LTS), Standard Term Support (STS), or Preview TFM. See https://dotnet.microsoft.com/platform/support/policy/dotnet-core for details on what these mean.</value>
</data>
<data name="UpgradeAssistantCommandVS" xml:space="preserve">
<value>Path to a VS install directory to be used for %VSINSTALLDIR%. If not provided, the latest installed version will be used.</value>

Просмотреть файл

@ -17,7 +17,7 @@
},
"DefaultTargetFrameworks": {
"Current": "net6.0",
"STS":"net7.0",
"LTS": "net6.0",
"Preview": "net7.0"
},

Просмотреть файл

@ -20,6 +20,6 @@ namespace Microsoft.DotNet.UpgradeAssistant
public string? Format { get; set; }
public UpgradeTarget TargetTfmSupport { get; set; } = UpgradeTarget.LTS;
public UpgradeTarget TargetTfmSupport { get; set; } = UpgradeTarget.STS;
}
}

Просмотреть файл

@ -6,7 +6,7 @@ namespace Microsoft.DotNet.UpgradeAssistant
public enum UpgradeTarget
{
LTS,
Current,
STS,
Preview
}
}

Просмотреть файл

@ -8,7 +8,7 @@ namespace Microsoft.DotNet.UpgradeAssistant
public class DefaultTfmOptions
{
[Required]
public string Current { get; set; } = null!;
public string STS { get; set; } = null!;
[Required]
public string LTS { get; set; } = null!;
@ -16,14 +16,14 @@ namespace Microsoft.DotNet.UpgradeAssistant
[Required]
public string Preview { get; set; } = null!;
public UpgradeTarget TargetTfmSupport { get; set; } = UpgradeTarget.Current;
public UpgradeTarget TargetTfmSupport { get; set; } = UpgradeTarget.STS;
public string DetermineTargetTfmValue() => this.TargetTfmSupport switch
{
UpgradeTarget.Current => this.Current,
UpgradeTarget.STS => this.STS,
UpgradeTarget.Preview => this.Preview,
UpgradeTarget.LTS => this.LTS,
_ => this.LTS,
_ => this.STS,
};
}
}

Просмотреть файл

@ -38,14 +38,13 @@ namespace Microsoft.DotNet.UpgradeAssistant.TargetFramework
var appBase = _selectorOptions.TargetTfmSupport switch
{
UpgradeTarget.Current => _selectorOptions.Current,
UpgradeTarget.STS => _selectorOptions.STS,
UpgradeTarget.Preview => _selectorOptions.Preview,
UpgradeTarget.LTS => _selectorOptions.LTS,
_ => _selectorOptions.LTS,
_ => _selectorOptions.STS,
};
var current = GetDefaultTargetFrameworkMoniker(project);
if (!_comparer.TryParse(appBase, out var appBaseTfm))
{
throw new InvalidOperationException("Invalid app base TFM");

Просмотреть файл

@ -38,7 +38,7 @@ namespace Microsoft.DotNet.UpgradeAssistant
public const string Net60_Android = "net6.0-android";
public const string Net60_iOS = "net6.0-ios";
public const string Current = Net50;
public const string STS = Net50;
public const string Preview = Net60;
public const string LTS = NetCoreApp31;

Просмотреть файл

@ -18,16 +18,16 @@ namespace Microsoft.DotNet.UpgradeAssistant.Tests
[InlineData(new string[] { }, new string[] { }, null)]
[InlineData(new[] { NetStandard20 }, new[] { NetStandard20 }, NetStandard20)]
[InlineData(new[] { NetStandard21 }, new[] { NetStandard20 }, NetStandard21)]
[InlineData(new[] { Current }, new[] { NetStandard20 }, Current)]
[InlineData(new[] { NetStandard20 }, new[] { Current }, Current)]
[InlineData(new[] { NetStandard20 }, new[] { NetStandard20, Current }, NetStandard20)]
[InlineData(new[] { NetStandard20 }, new[] { Current, NetStandard20 }, NetStandard20)]
[InlineData(new[] { Current, LTS }, new[] { Current, NetStandard20 }, LTS)]
[InlineData(new[] { LTS, Current }, new[] { Current, NetStandard20 }, LTS)]
[InlineData(new[] { Current, NetStandard20 }, new[] { Current, LTS }, LTS)]
[InlineData(new[] { Current }, new[] { Current, NetStandard20 }, Current)]
[InlineData(new[] { Current, NetStandard20 }, new[] { Current }, Current)]
[InlineData(new[] { Current, NetStandard20 }, new[] { NetStandard20 }, NetStandard20)]
[InlineData(new[] { STS }, new[] { NetStandard20 }, STS)]
[InlineData(new[] { NetStandard20 }, new[] { STS }, STS)]
[InlineData(new[] { NetStandard20 }, new[] { NetStandard20, STS }, NetStandard20)]
[InlineData(new[] { NetStandard20 }, new[] { STS, NetStandard20 }, NetStandard20)]
[InlineData(new[] { STS, LTS }, new[] { STS, NetStandard20 }, LTS)]
[InlineData(new[] { LTS, STS }, new[] { STS, NetStandard20 }, LTS)]
[InlineData(new[] { STS, NetStandard20 }, new[] { STS, LTS }, LTS)]
[InlineData(new[] { STS }, new[] { STS, NetStandard20 }, STS)]
[InlineData(new[] { STS, NetStandard20 }, new[] { STS }, STS)]
[InlineData(new[] { STS, NetStandard20 }, new[] { NetStandard20 }, NetStandard20)]
[Theory]
public void WithDependencies(string[] dep1Tfms, string[] dep2tfms, string? expected)
{
@ -65,16 +65,15 @@ namespace Microsoft.DotNet.UpgradeAssistant.Tests
_ when x == y => 0,
(Net45, _) => -1,
(_, Net45) => 1,
(Preview, Current) => 1,
(Current, Preview) => -1,
(Preview, STS) => 1,
(NetStandard20, NetStandard21) => -1,
(NetStandard21, NetStandard20) => 1,
(NetStandard20, Current) => -1,
(Current, NetStandard20) => 1,
(NetStandard20, STS) => -1,
(STS, NetStandard20) => 1,
(NetStandard20, LTS) => -1,
(LTS, NetStandard20) => 1,
(LTS, Current) => -1,
(Current, LTS) => 1,
(LTS, STS) => -1,
(STS, LTS) => 1,
_ => throw new NotImplementedException(),
};

Просмотреть файл

@ -22,7 +22,7 @@ namespace Microsoft.DotNet.UpgradeAssistant.Tests
{
private readonly DefaultTfmOptions _options = new DefaultTfmOptions
{
Current = Current,
STS = STS,
LTS = LTS,
Preview = Preview,
};
@ -30,27 +30,27 @@ namespace Microsoft.DotNet.UpgradeAssistant.Tests
[Fact]
public void VerifyTestTfms()
{
Assert.True(ParseTfm(Current).IsNetCore);
Assert.True(ParseTfm(STS).IsNetCore);
Assert.True(ParseTfm(LTS).IsNetCore);
Assert.True(ParseTfm(Preview).IsNetCore);
Assert.True(ParseTfm(NetStandard20).IsNetStandard);
}
[InlineData(new[] { NetStandard20 }, NetStandard20, UpgradeTarget.Current, ProjectComponents.None)]
[InlineData(new[] { NetStandard20 }, NetStandard20, UpgradeTarget.STS, ProjectComponents.None)]
[InlineData(new[] { NetStandard20 }, NetStandard20, UpgradeTarget.LTS, ProjectComponents.None)]
[InlineData(new[] { NetStandard21 }, NetStandard21, UpgradeTarget.Current, ProjectComponents.None)]
[InlineData(new[] { NetStandard21 }, NetStandard21, UpgradeTarget.STS, ProjectComponents.None)]
[InlineData(new[] { NetStandard21 }, NetStandard21, UpgradeTarget.LTS, ProjectComponents.None)]
[InlineData(new[] { Net45 }, NetStandard20, UpgradeTarget.LTS, ProjectComponents.None)]
[InlineData(new[] { Net45 }, NetStandard20, UpgradeTarget.LTS, ProjectComponents.WindowsDesktop)]
[InlineData(new[] { Net45 }, NetStandard20, UpgradeTarget.Current, ProjectComponents.WindowsDesktop)]
[InlineData(new[] { Net45 }, NetStandard20, UpgradeTarget.STS, ProjectComponents.WindowsDesktop)]
[InlineData(new[] { Net45 }, NetStandard20, UpgradeTarget.LTS, ProjectComponents.WindowsDesktop | ProjectComponents.WinRT)]
[InlineData(new[] { Net45 }, NetStandard20, UpgradeTarget.Current, ProjectComponents.WindowsDesktop | ProjectComponents.WinRT)]
[InlineData(new[] { Net45 }, NetStandard20, UpgradeTarget.Current, ProjectComponents.None)]
[InlineData(new[] { Net45 }, NetStandard20, UpgradeTarget.Current, ProjectComponents.AspNet)]
[InlineData(new[] { Net45 }, NetStandard20, UpgradeTarget.STS, ProjectComponents.WindowsDesktop | ProjectComponents.WinRT)]
[InlineData(new[] { Net45 }, NetStandard20, UpgradeTarget.STS, ProjectComponents.None)]
[InlineData(new[] { Net45 }, NetStandard20, UpgradeTarget.STS, ProjectComponents.AspNet)]
[InlineData(new[] { Net45 }, NetStandard20, UpgradeTarget.LTS, ProjectComponents.AspNet)]
[InlineData(new[] { Net45 }, NetStandard20, UpgradeTarget.Current, ProjectComponents.AspNetCore)]
[InlineData(new[] { Preview }, NetStandard20, UpgradeTarget.Current, ProjectComponents.AspNetCore)]
[InlineData(new[] { Net45, Preview }, NetStandard20, UpgradeTarget.Current, ProjectComponents.AspNetCore)]
[InlineData(new[] { Net45 }, NetStandard20, UpgradeTarget.STS, ProjectComponents.AspNetCore)]
[InlineData(new[] { Preview }, NetStandard20, UpgradeTarget.STS, ProjectComponents.AspNetCore)]
[InlineData(new[] { Net45, Preview }, NetStandard20, UpgradeTarget.STS, ProjectComponents.AspNetCore)]
[Theory]
public async Task NoDependencies(string[] currentTfms, string current, UpgradeTarget target, ProjectComponents components)
{
@ -70,7 +70,7 @@ namespace Microsoft.DotNet.UpgradeAssistant.Tests
.Setup(o => o.Value)
.Returns(new DefaultTfmOptions
{
Current = Current,
STS = STS,
LTS = LTS,
Preview = Preview,
TargetTfmSupport = target
@ -80,7 +80,7 @@ namespace Microsoft.DotNet.UpgradeAssistant.Tests
moniker.Setup(c => c.TryMerge(ParseTfm(current), tfm, out finalTfm)).Returns(true);
moniker.SetupTryParse();
var appBase = target == UpgradeTarget.Current ? _options.Current : _options.LTS;
var appBase = target == UpgradeTarget.STS ? _options.STS : _options.LTS;
var selector = mock.Create<TargetFrameworkSelector>();

Просмотреть файл

@ -38,8 +38,10 @@ namespace Integration.Tests
[InlineData("PCL", "SamplePCL.csproj", "")]
[InlineData("WpfSample/csharp", "BeanTrader.sln", "BeanTraderClient.csproj")]
/*
[InlineData("WebLibrary/csharp", "WebLibrary.csproj", "")]
[InlineData("AspNetSample/csharp", "TemplateMvc.csproj", "")]
*/
[InlineData("WpfSample/vb", "WpfApp1.sln", "")]
[InlineData("WCFSample", "ConsoleApp.csproj", "")]
[InlineData("MauiSample/droid", "EwDavidForms.sln", "EwDavidForms.Android.csproj")]

Просмотреть файл

@ -3,7 +3,7 @@
<OutputType>Exe</OutputType>
</PropertyGroup>
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net7.0</TargetFramework>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<OutputPath>bin\</OutputPath>
</PropertyGroup>

Просмотреть файл

@ -160,7 +160,7 @@
{
"id": "Microsoft.DotNet.UpgradeAssistant.Steps.ProjectFormat.SetTFMStep",
"fullDescription": {
"text": "Updated TFM to net6.0"
"text": "Updated TFM to net7.0"
},
"helpUri": "about:blank"
}
@ -171,7 +171,7 @@
{
"ruleId": "Microsoft.DotNet.UpgradeAssistant.Steps.ProjectFormat.SetTFMStep",
"message": {
"text": "Complete: Updated TFM to net6.0"
"text": "Complete: Updated TFM to net7.0"
},
"locations": [
{

Просмотреть файл

@ -5,7 +5,7 @@
<UseMaui>true</UseMaui>
</PropertyGroup>
<PropertyGroup>
<TargetFramework>net6.0-android</TargetFramework>
<TargetFramework>net7.0-android</TargetFramework>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\EwDavidForms\EwDavidForms.csproj" />

Просмотреть файл

@ -863,7 +863,7 @@
{
"id": "Microsoft.DotNet.UpgradeAssistant.Steps.ProjectFormat.SetTFMStep",
"fullDescription": {
"text": "Updated TFM to net6.0-android"
"text": "Updated TFM to net7.0-android"
},
"helpUri": "about:blank"
}
@ -874,7 +874,7 @@
{
"ruleId": "Microsoft.DotNet.UpgradeAssistant.Steps.ProjectFormat.SetTFMStep",
"message": {
"text": "Complete: Updated TFM to net6.0-android"
"text": "Complete: Updated TFM to net7.0-android"
},
"locations": [
{

Просмотреть файл

@ -13,7 +13,7 @@
<CodesignEntitlements>Entitlements.plist</CodesignEntitlements>
</PropertyGroup>
<PropertyGroup>
<TargetFramework>net6.0-ios</TargetFramework>
<TargetFramework>net7.0-ios</TargetFramework>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\EwDavidForms\EwDavidForms.csproj" />

Просмотреть файл

@ -752,7 +752,7 @@
{
"id": "Microsoft.DotNet.UpgradeAssistant.Steps.ProjectFormat.SetTFMStep",
"fullDescription": {
"text": "Updated TFM to net6.0-ios"
"text": "Updated TFM to net7.0-ios"
},
"helpUri": "about:blank"
}
@ -763,7 +763,7 @@
{
"ruleId": "Microsoft.DotNet.UpgradeAssistant.Steps.ProjectFormat.SetTFMStep",
"message": {
"text": "Complete: Updated TFM to net6.0-ios"
"text": "Complete: Updated TFM to net7.0-ios"
},
"locations": [
{

Просмотреть файл

@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net6.0-windows10.0.19041.0</TargetFramework>
<TargetFramework>net7.0-windows10.0.19041.0</TargetFramework>
<Platform Condition=" '$(Platform)' == '' ">x86</Platform>
<OutputType>WinExe</OutputType>
<DefaultLanguage>en-US</DefaultLanguage>

Просмотреть файл

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net7.0</TargetFramework>
<OutputType>Exe</OutputType>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
</PropertyGroup>

Просмотреть файл

@ -123,7 +123,7 @@
{
"id": "Microsoft.DotNet.UpgradeAssistant.Steps.ProjectFormat.SetTFMStep",
"fullDescription": {
"text": "Updated TFM to net6.0"
"text": "Updated TFM to net7.0"
},
"helpUri": "about:blank"
}
@ -134,7 +134,7 @@
{
"ruleId": "Microsoft.DotNet.UpgradeAssistant.Steps.ProjectFormat.SetTFMStep",
"message": {
"text": "Complete: Updated TFM to net6.0"
"text": "Complete: Updated TFM to net7.0"
},
"locations": [
{

Просмотреть файл

@ -197,7 +197,7 @@
{
"id": "Microsoft.DotNet.UpgradeAssistant.Steps.ProjectFormat.SetTFMStep",
"fullDescription": {
"text": "Updated TFM to net6.0"
"text": "Updated TFM to net7.0"
},
"helpUri": "about:blank"
}
@ -208,7 +208,7 @@
{
"ruleId": "Microsoft.DotNet.UpgradeAssistant.Steps.ProjectFormat.SetTFMStep",
"message": {
"text": "Complete: Updated TFM to net6.0"
"text": "Complete: Updated TFM to net7.0"
},
"locations": [
{

Просмотреть файл

@ -3,7 +3,7 @@
<OutputType>Library</OutputType>
</PropertyGroup>
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net7.0</TargetFramework>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
</PropertyGroup>
<ItemGroup>

Просмотреть файл

@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net6.0-windows</TargetFramework>
<TargetFramework>net7.0-windows</TargetFramework>
<OutputType>WinExe</OutputType>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<UseWindowsForms>true</UseWindowsForms>

Просмотреть файл

@ -1529,7 +1529,7 @@
{
"id": "Microsoft.DotNet.UpgradeAssistant.Steps.ProjectFormat.SetTFMStep",
"fullDescription": {
"text": "Updated TFM to net6.0-windows"
"text": "Updated TFM to net7.0-windows"
},
"helpUri": "about:blank"
}
@ -1540,7 +1540,7 @@
{
"ruleId": "Microsoft.DotNet.UpgradeAssistant.Steps.ProjectFormat.SetTFMStep",
"message": {
"text": "Complete: Updated TFM to net6.0-windows"
"text": "Complete: Updated TFM to net7.0-windows"
},
"locations": [
{

Просмотреть файл

@ -86,7 +86,7 @@
{
"id": "Microsoft.DotNet.UpgradeAssistant.Steps.ProjectFormat.SetTFMStep",
"fullDescription": {
"text": "Updated TFM to net6.0-windows"
"text": "Updated TFM to net7.0-windows"
},
"helpUri": "about:blank"
}
@ -97,7 +97,7 @@
{
"ruleId": "Microsoft.DotNet.UpgradeAssistant.Steps.ProjectFormat.SetTFMStep",
"message": {
"text": "Complete: Updated TFM to net6.0-windows"
"text": "Complete: Updated TFM to net7.0-windows"
},
"locations": [
{

Просмотреть файл

@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net6.0-windows</TargetFramework>
<TargetFramework>net7.0-windows</TargetFramework>
<OutputType>WinExe</OutputType>
<MyType>Custom</MyType>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>