Merge CLI 2.2.1xx changes
This commit is contained in:
commit
bfcc6fa2a0
8 changed files with 265 additions and 73 deletions
|
@ -58,6 +58,46 @@
|
|||
PropertyName="_UseBundledNETCoreAppPackageVersionAsDefaultNetCorePatchVersion" />
|
||||
</GetUseBundledNETCoreAppPackageVersionAsDefaultNetCorePatchVersion>
|
||||
|
||||
<ItemGroup>
|
||||
<ImplicitPackageVariable Include="Microsoft.NETCore.App"
|
||||
TargetFrameworkVersion="1.0"
|
||||
DefaultVersion="1.0.5"
|
||||
LatestVersion="1.0.12" />
|
||||
<ImplicitPackageVariable Include="Microsoft.NETCore.App"
|
||||
TargetFrameworkVersion="1.1"
|
||||
DefaultVersion="1.1.2"
|
||||
LatestVersion="1.1.9" />
|
||||
<ImplicitPackageVariable Include="Microsoft.NETCore.App"
|
||||
TargetFrameworkVersion="2.0"
|
||||
DefaultVersion="2.0.0"
|
||||
LatestVersion="2.0.9" />
|
||||
<ImplicitPackageVariable Include="Microsoft.NETCore.App"
|
||||
TargetFrameworkVersion="2.1"
|
||||
DefaultVersion="2.1.0"
|
||||
LatestVersion="2.1.5" />
|
||||
<ImplicitPackageVariable Include="Microsoft.NETCore.App"
|
||||
TargetFrameworkVersion="2.2"
|
||||
DefaultVersion="$(_NETCoreAppPackageVersion)"
|
||||
LatestVersion="$(_NETCoreAppPackageVersion)" />
|
||||
|
||||
<ImplicitPackageVariable Include="Microsoft.AspNetCore.App"
|
||||
TargetFrameworkVersion="2.1"
|
||||
DefaultVersion="2.1.1"
|
||||
LatestVersion="2.1.5"/>
|
||||
<ImplicitPackageVariable Include="Microsoft.AspNetCore.All"
|
||||
TargetFrameworkVersion="2.1"
|
||||
DefaultVersion="2.1.1"
|
||||
LatestVersion="2.1.5"/>
|
||||
<ImplicitPackageVariable Include="Microsoft.AspNetCore.App"
|
||||
TargetFrameworkVersion="2.2"
|
||||
DefaultVersion="$(_AspNetCoreAppPackageVersion)"
|
||||
LatestVersion="$(_AspNetCoreAppPackageVersion)"/>
|
||||
<ImplicitPackageVariable Include="Microsoft.AspNetCore.All"
|
||||
TargetFrameworkVersion="2.2"
|
||||
DefaultVersion="$(_AspNetCoreAllPackageVersion)"
|
||||
LatestVersion="$(_AspNetCoreAllPackageVersion)"/>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<BundledVersionsVariable Include="BundledAspNetCoreAllTargetFrameworkVersion" Value="$(_AspNetCoreAllTargetFrameworkVersion)" />
|
||||
<BundledVersionsVariable Include="BundledAspNetCoreAllPackageVersion" Value="$(_AspNetCoreAllPackageVersion)" />
|
||||
|
@ -120,6 +160,9 @@ Copyright (c) .NET Foundation. All rights reserved.
|
|||
<LatestPatchVersionForNetCore2_1 Condition="'%24(LatestPatchVersionForNetCore2_1)' == ''">2.1.2</LatestPatchVersionForNetCore2_1>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
@(ImplicitPackageVariable->'<ImplicitPackageReferenceVersion Include="%(Identity)" TargetFrameworkVersion="%(TargetFrameworkVersion)" DefaultVersion="%(DefaultVersion)" LatestVersion="%(LatestVersion)"/>', '%0A ')
|
||||
|
||||
|
||||
<KnownFrameworkReference Include="Microsoft.DesktopUI"
|
||||
RuntimeFrameworkName="Microsoft.DesktopUI.App"
|
||||
DefaultRuntimeFrameworkVersion="$(MicrosoftDesktopUIPackageVersion)"
|
||||
|
|
|
@ -105,17 +105,17 @@
|
|||
Inputs="@(GenerateSdkMsiInputs)"
|
||||
Outputs="$(SdkInstallerFile)">
|
||||
|
||||
<Exec Command="powershell -NoProfile -NoLogo $(SdkGenerateMsiPowershellScript)
|
||||
'$(SdkLayoutOutputDirectory)'
|
||||
'$(SdkInstallerFile)'
|
||||
'$(WixRoot)'
|
||||
'$(SdkBrandName)'
|
||||
'$(MsiVersion)'
|
||||
'$(SimpleVersion)'
|
||||
'$(NugetVersion)'
|
||||
'$(SdkInstallerUpgradeCode)'
|
||||
'$(Architecture)'
|
||||
'$(SdkStableFileIdForApphostTransform)'
|
||||
<Exec Command="powershell -NoProfile -NoLogo $(SdkGenerateMsiPowershellScript) ^
|
||||
'$(SdkLayoutOutputDirectory)' ^
|
||||
'$(SdkInstallerFile)' ^
|
||||
'$(WixRoot)' ^
|
||||
'$(SdkBrandName)' ^
|
||||
'$(MsiVersion)' ^
|
||||
'$(SimpleVersion)' ^
|
||||
'$(NugetVersion)' ^
|
||||
'$(SdkInstallerUpgradeCode)' ^
|
||||
'$(Architecture)' ^
|
||||
'$(SdkStableFileIdForApphostTransform)' ^
|
||||
" />
|
||||
</Target>
|
||||
|
||||
|
@ -127,15 +127,15 @@
|
|||
|
||||
<!-- Disabling this for now because we don't have the MSBuildExtensions available. -->
|
||||
|
||||
<!-- <Exec Command="powershell -NoProfile -NoLogo $(MSBuildExtensionsGenerateMsiPowershellScript)
|
||||
'$(MSBuildExtensionsOutputDirectory)'
|
||||
'$(MSBuildExtensionsInstallerFile)'
|
||||
'$(WixRoot)'
|
||||
'$(MSBuildExtensionsBrandName)'
|
||||
'$(SimpleVersion)'
|
||||
'$(SimpleVersion)'
|
||||
'$(NugetVersion)'
|
||||
'$(MSBuildExtensionsInstallerUpgradeCode)'
|
||||
<!-- <Exec Command="powershell -NoProfile -NoLogo $(MSBuildExtensionsGenerateMsiPowershellScript) ^
|
||||
'$(MSBuildExtensionsOutputDirectory)' ^
|
||||
'$(MSBuildExtensionsInstallerFile)' ^
|
||||
'$(WixRoot)' ^
|
||||
'$(MSBuildExtensionsBrandName)' ^
|
||||
'$(SimpleVersion)' ^
|
||||
'$(SimpleVersion)' ^
|
||||
'$(NugetVersion)' ^
|
||||
'$(MSBuildExtensionsInstallerUpgradeCode)' ^
|
||||
'$(Architecture)'" /> -->
|
||||
</Target>
|
||||
|
||||
|
@ -149,22 +149,22 @@
|
|||
$(SdkGenerateBundlePowershellScript)"
|
||||
Outputs="$(CombinedFrameworkSdkHostInstallerFile)">
|
||||
|
||||
<Exec Command="powershell -NoProfile -NoLogo $(SdkGenerateBundlePowershellScript)
|
||||
'$(SdkInstallerFile)'
|
||||
'$(DownloadedAspNetCoreSharedFxInstallerFile)'
|
||||
'$(DownloadedSharedFrameworkInstallerFile)'
|
||||
'$(DownloadedHostFxrInstallerFile)'
|
||||
'$(DownloadedSharedHostInstallerFile)'
|
||||
'$(DownloadedWinFormsAndWpfSharedFrameworkInstallerFile)'
|
||||
'$(CombinedFrameworkSdkHostInstallerFile)'
|
||||
'$(WixRoot)'
|
||||
'$(SdkBrandName)'
|
||||
'$(MsiVersion)'
|
||||
'$(SimpleVersion)'
|
||||
'$(NugetVersion)'
|
||||
'$(CombinedFrameworkSDKHostInstallerUpgradeCode)'
|
||||
'$(Architecture)'
|
||||
'$(MicrosoftNETCoreAppPackageVersion)'
|
||||
<Exec Command="powershell -NoProfile -NoLogo $(SdkGenerateBundlePowershellScript) ^
|
||||
'$(SdkInstallerFile)' ^
|
||||
'$(DownloadedAspNetCoreSharedFxInstallerFile)' ^
|
||||
'$(DownloadedSharedFrameworkInstallerFile)' ^
|
||||
'$(DownloadedHostFxrInstallerFile)' ^
|
||||
'$(DownloadedSharedHostInstallerFile)' ^
|
||||
'$(DownloadedWinFormsAndWpfSharedFrameworkInstallerFile)' ^
|
||||
'$(CombinedFrameworkSdkHostInstallerFile)' ^
|
||||
'$(WixRoot)' ^
|
||||
'$(SdkBrandName)' ^
|
||||
'$(MsiVersion)' ^
|
||||
'$(SimpleVersion)' ^
|
||||
'$(NugetVersion)' ^
|
||||
'$(CombinedFrameworkSDKHostInstallerUpgradeCode)' ^
|
||||
'$(Architecture)' ^
|
||||
'$(MicrosoftNETCoreAppPackageVersion)' ^
|
||||
'$(AspNetCoreVersion)'" />
|
||||
</Target>
|
||||
|
||||
|
@ -176,10 +176,10 @@
|
|||
$(SdkGenerateNupkgPowershellScript)"
|
||||
Outputs="$(SdkInstallerNupkgFile)">
|
||||
|
||||
<Exec Command="powershell -NoProfile -NoLogo $(SdkGenerateNupkgPowershellScript)
|
||||
'$(CombinedFrameworkSdkHostInstallerFile)'
|
||||
'$(FullNugetVersion)'
|
||||
'$(SdkInstallerNuspecFile)'
|
||||
<Exec Command="powershell -NoProfile -NoLogo $(SdkGenerateNupkgPowershellScript) ^
|
||||
'$(CombinedFrameworkSdkHostInstallerFile)' ^
|
||||
'$(FullNugetVersion)' ^
|
||||
'$(SdkInstallerNuspecFile)' ^
|
||||
'$(SdkInstallerNupkgFile)'" />
|
||||
</Target>
|
||||
|
||||
|
@ -193,10 +193,10 @@
|
|||
|
||||
<!-- Disabling this for now because we don't have the MSBuildExtensions available. -->
|
||||
|
||||
<!-- <Exec Command="powershell -NoProfile -NoLogo $(SdkGenerateNupkgPowershellScript)
|
||||
'$(MSBuildExtensionsLayoutDirectory)'
|
||||
'$(FullNugetVersion)'
|
||||
'$(SdkMSBuildExtensionsNuspecFile)'
|
||||
<!-- <Exec Command="powershell -NoProfile -NoLogo $(SdkGenerateNupkgPowershellScript) ^
|
||||
'$(MSBuildExtensionsLayoutDirectory)' ^
|
||||
'$(FullNugetVersion)' ^
|
||||
'$(SdkMSBuildExtensionsNuspecFile)' ^
|
||||
'$(SdkMSBuildExtensionsNupkgFile)'" />
|
||||
|
||||
<GenerateMSBuildExtensionsSWR MSBuildExtensionsLayoutDirectory="$(MSBuildExtensionsLayoutDirectory)"
|
||||
|
|
|
@ -95,6 +95,7 @@ namespace Microsoft.DotNet.Scripts
|
|||
yield return CreateRegexUpdater(dependencyVersionsPath, "DotnetSqlCachePackageVersion", "dotnet-sql-cache");
|
||||
yield return CreateRegexUpdater(dependencyVersionsPath, "DotnetUserSecretsPackageVersion", "dotnet-user-secrets");
|
||||
yield return CreateRegexUpdater(dependencyVersionsPath, "DotnetWatchPackageVersion", "dotnet-watch");
|
||||
yield return CreateRegexUpdater(dependencyVersionsPath, "MicrosoftNETSdkRazorPackageVersion", "Microsoft.NET.Sdk.Razor");
|
||||
}
|
||||
if (s_config.HasVersionFragment("coresetup"))
|
||||
{
|
||||
|
|
|
@ -17,10 +17,29 @@ namespace EndToEnd
|
|||
{
|
||||
[Theory]
|
||||
[ClassData(typeof(SupportedNetCoreAppVersions))]
|
||||
public void ItDoesNotRollForwardToTheLatestVersion(string minorVersion)
|
||||
public void ItDoesNotRollForwardToTheLatestVersionOfNetCore(string minorVersion)
|
||||
{
|
||||
ItDoesNotRollForwardToTheLatestVersion(GivenSelfContainedAppsRollForward.NETCorePackageName, minorVersion);
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[ClassData(typeof(SupportedAspNetCoreVersions))]
|
||||
public void ItDoesNotRollForwardToTheLatestVersionOfAspNetCoreApp(string minorVersion)
|
||||
{
|
||||
ItDoesNotRollForwardToTheLatestVersion(GivenSelfContainedAppsRollForward.AspNetCoreAppPackageName, minorVersion);
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[ClassData(typeof(SupportedAspNetCoreVersions))]
|
||||
public void ItDoesNotRollForwardToTheLatestVersionOfAspNetCoreAll(string minorVersion)
|
||||
{
|
||||
ItDoesNotRollForwardToTheLatestVersion(GivenSelfContainedAppsRollForward.AspNetCoreAllPackageName, minorVersion);
|
||||
}
|
||||
|
||||
public void ItDoesNotRollForwardToTheLatestVersion(string packageName, string minorVersion)
|
||||
{
|
||||
var _testInstance = TestAssets.Get("TestAppSimple")
|
||||
.CreateInstance(identifier: minorVersion)
|
||||
.CreateInstance(identifier: packageName + "_" + minorVersion)
|
||||
// scope the feed to only dotnet-core feed to avoid flaky when different feed has a newer / lower version
|
||||
.WithNuGetConfig(new RepoDirectoriesProvider().TestPackages)
|
||||
.WithSourceFiles();
|
||||
|
@ -37,6 +56,13 @@ namespace EndToEnd
|
|||
.Element(ns + "TargetFramework")
|
||||
.Value = "netcoreapp" + minorVersion;
|
||||
|
||||
if (packageName != GivenSelfContainedAppsRollForward.NETCorePackageName)
|
||||
{
|
||||
// Add implicit ASP.NET reference
|
||||
project.Root.Add(new XElement(ns + "ItemGroup",
|
||||
new XElement(ns + "PackageReference", new XAttribute("Include", packageName))));
|
||||
}
|
||||
|
||||
project.Save(projectPath);
|
||||
|
||||
// Get the resolved version of .NET Core
|
||||
|
@ -48,7 +74,7 @@ namespace EndToEnd
|
|||
string assetsFilePath = Path.Combine(projectDirectory, "obj", "project.assets.json");
|
||||
var assetsFile = new LockFileFormat().Read(assetsFilePath);
|
||||
|
||||
var versionInAssertsJson = GetNetCoreAppVersion(assetsFile);
|
||||
var versionInAssertsJson = GetPackageVersion(assetsFile, packageName);
|
||||
versionInAssertsJson.Should().NotBeNull();
|
||||
|
||||
if (versionInAssertsJson.IsPrerelease && versionInAssertsJson.Patch == 0)
|
||||
|
@ -59,18 +85,18 @@ namespace EndToEnd
|
|||
return;
|
||||
}
|
||||
|
||||
versionInAssertsJson.ToNormalizedString().Should().BeEquivalentTo(GetExpectedVersion(minorVersion));
|
||||
versionInAssertsJson.ToNormalizedString().Should().BeEquivalentTo(GetExpectedVersion(packageName, minorVersion));
|
||||
}
|
||||
|
||||
private NuGetVersion GetNetCoreAppVersion(LockFile lockFile)
|
||||
private static NuGetVersion GetPackageVersion(LockFile lockFile, string packageName)
|
||||
{
|
||||
return lockFile?.Targets?.SingleOrDefault(t => t.RuntimeIdentifier == null)
|
||||
?.Libraries?.SingleOrDefault(l =>
|
||||
string.Compare(l.Name, "Microsoft.NETCore.App", StringComparison.CurrentCultureIgnoreCase) == 0)
|
||||
string.Compare(l.Name, packageName, StringComparison.CurrentCultureIgnoreCase) == 0)
|
||||
?.Version;
|
||||
}
|
||||
|
||||
public string GetExpectedVersion(string minorVersion)
|
||||
public string GetExpectedVersion(string packageName, string minorVersion)
|
||||
{
|
||||
if (minorVersion.StartsWith("1.0"))
|
||||
{
|
||||
|
@ -82,6 +108,16 @@ namespace EndToEnd
|
|||
}
|
||||
else
|
||||
{
|
||||
// ASP.NET 2.1.0 packages had exact version dependencies, which was problematic,
|
||||
// so the default version for 2.1 apps is 2.1.1.
|
||||
if (packageName == GivenSelfContainedAppsRollForward.AspNetCoreAppPackageName ||
|
||||
packageName == GivenSelfContainedAppsRollForward.AspNetCoreAllPackageName)
|
||||
{
|
||||
if (minorVersion == "2.1")
|
||||
{
|
||||
return "2.1.1";
|
||||
}
|
||||
}
|
||||
var parsed = NuGetVersion.Parse(minorVersion);
|
||||
return new NuGetVersion(parsed.Major, parsed.Minor, 0).ToNormalizedString();
|
||||
}
|
||||
|
|
|
@ -16,23 +16,37 @@ namespace EndToEnd
|
|||
{
|
||||
public partial class GivenSelfContainedAppsRollForward : TestBase
|
||||
{
|
||||
public const string NETCorePackageName = "Microsoft.NETCore.App";
|
||||
public const string AspNetCoreAppPackageName = "Microsoft.AspNetCore.App";
|
||||
public const string AspNetCoreAllPackageName = "Microsoft.AspNetCore.All";
|
||||
|
||||
[Theory]
|
||||
// MemberData is used instead of InlineData here so we can access it in another test to
|
||||
// verify that we are covering the latest release of .NET Core
|
||||
[ClassData(typeof(SupportedNetCoreAppVersions))]
|
||||
public void ItRollsForwardToTheLatestVersion(string minorVersion)
|
||||
public void ItRollsForwardToTheLatestNetCoreVersion(string minorVersion)
|
||||
{
|
||||
// https://github.com/dotnet/cli/issues/9661
|
||||
// https://github.com/dotnet/sdk/issues/2446
|
||||
// dotnet/sdk is missing handling for 2.1 when it isn't the latest runtime
|
||||
if (minorVersion == "2.1")
|
||||
{
|
||||
return;
|
||||
}
|
||||
ItRollsForwardToTheLatestVersion(NETCorePackageName, minorVersion);
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[ClassData(typeof(SupportedAspNetCoreVersions))]
|
||||
public void ItRollsForwardToTheLatestAspNetCoreAppVersion(string minorVersion)
|
||||
{
|
||||
ItRollsForwardToTheLatestVersion(AspNetCoreAppPackageName, minorVersion);
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[ClassData(typeof(SupportedAspNetCoreVersions))]
|
||||
public void ItRollsForwardToTheLatestAspNetCoreAllVersion(string minorVersion)
|
||||
{
|
||||
ItRollsForwardToTheLatestVersion(AspNetCoreAllPackageName, minorVersion);
|
||||
}
|
||||
|
||||
public void ItRollsForwardToTheLatestVersion(string packageName, string minorVersion)
|
||||
{
|
||||
var _testInstance = TestAssets.Get("TestAppSimple")
|
||||
.CreateInstance(identifier: minorVersion)
|
||||
.CreateInstance(identifier: packageName + "_" + minorVersion)
|
||||
.WithSourceFiles();
|
||||
|
||||
string projectDirectory = _testInstance.Root.FullName;
|
||||
|
@ -53,6 +67,13 @@ namespace EndToEnd
|
|||
project.Root.Element(ns + "PropertyGroup")
|
||||
.Add(new XElement(ns + "RuntimeIdentifier", rid));
|
||||
|
||||
if (packageName != NETCorePackageName)
|
||||
{
|
||||
// Add implicit ASP.NET reference
|
||||
project.Root.Add(new XElement(ns + "ItemGroup",
|
||||
new XElement(ns + "PackageReference", new XAttribute("Include", packageName))));
|
||||
}
|
||||
|
||||
project.Save(projectPath);
|
||||
|
||||
// Get the version rolled forward to
|
||||
|
@ -64,7 +85,7 @@ namespace EndToEnd
|
|||
string assetsFilePath = Path.Combine(projectDirectory, "obj", "project.assets.json");
|
||||
var assetsFile = new LockFileFormat().Read(assetsFilePath);
|
||||
|
||||
var rolledForwardVersion = GetNetCoreAppVersion(assetsFile);
|
||||
var rolledForwardVersion = GetPackageVersion(assetsFile, packageName);
|
||||
rolledForwardVersion.Should().NotBeNull();
|
||||
|
||||
if (rolledForwardVersion.IsPrerelease)
|
||||
|
@ -76,10 +97,21 @@ namespace EndToEnd
|
|||
return;
|
||||
}
|
||||
|
||||
// Float the RuntimeFrameworkVersion to get the latest version of the runtime available from feeds
|
||||
Directory.Delete(Path.Combine(projectDirectory, "obj"), true);
|
||||
project.Root.Element(ns + "PropertyGroup")
|
||||
.Add(new XElement(ns + "RuntimeFrameworkVersion", $"{minorVersion}.*"));
|
||||
if (packageName == NETCorePackageName)
|
||||
{
|
||||
// Float the RuntimeFrameworkVersion to get the latest version of the runtime available from feeds
|
||||
project.Root.Element(ns + "PropertyGroup")
|
||||
.Add(new XElement(ns + "RuntimeFrameworkVersion", $"{minorVersion}.*"));
|
||||
}
|
||||
else
|
||||
{
|
||||
project.Root.Element(ns + "ItemGroup")
|
||||
.Element(ns + "PackageReference")
|
||||
.Add(new XAttribute("Version", $"{minorVersion}.*"),
|
||||
new XAttribute("AllowExplicitVersion", "true"));
|
||||
}
|
||||
|
||||
project.Save(projectPath);
|
||||
|
||||
new RestoreCommand()
|
||||
|
@ -89,19 +121,19 @@ namespace EndToEnd
|
|||
|
||||
var floatedAssetsFile = new LockFileFormat().Read(assetsFilePath);
|
||||
|
||||
var floatedVersion = GetNetCoreAppVersion(floatedAssetsFile);
|
||||
var floatedVersion = GetPackageVersion(floatedAssetsFile, packageName);
|
||||
floatedVersion.Should().NotBeNull();
|
||||
|
||||
rolledForwardVersion.ToNormalizedString().Should().BeEquivalentTo(floatedVersion.ToNormalizedString(),
|
||||
"the latest patch version properties in Microsoft.NETCoreSdk.BundledVersions.props need to be updated " +
|
||||
"(see MSBuildExtensions.targets in this repo)");
|
||||
$"the latest patch version for {packageName} {minorVersion} in Microsoft.NETCoreSdk.BundledVersions.props " +
|
||||
"needs to be updated (see the ImplicitPackageVariable items in MSBuildExtensions.targets in this repo)");
|
||||
}
|
||||
|
||||
private NuGetVersion GetNetCoreAppVersion(LockFile lockFile)
|
||||
private static NuGetVersion GetPackageVersion(LockFile lockFile, string packageName)
|
||||
{
|
||||
return lockFile?.Targets?.SingleOrDefault(t => t.RuntimeIdentifier != null)
|
||||
?.Libraries?.SingleOrDefault(l =>
|
||||
string.Compare(l.Name, "Microsoft.NETCore.App", StringComparison.CurrentCultureIgnoreCase) == 0)
|
||||
string.Compare(l.Name, packageName, StringComparison.CurrentCultureIgnoreCase) == 0)
|
||||
?.Version;
|
||||
}
|
||||
|
||||
|
@ -127,11 +159,40 @@ namespace EndToEnd
|
|||
.Element(ns + "TargetFramework")
|
||||
.Value;
|
||||
|
||||
SupportedNetCoreAppVersions.Versions.Select(v => $"netcoreapp{v[0]}")
|
||||
SupportedNetCoreAppVersions.Versions.Select(v => $"netcoreapp{v}")
|
||||
.Should().Contain(targetFramework, $"the {nameof(SupportedNetCoreAppVersions)}.{nameof(SupportedNetCoreAppVersions.Versions)} property should include the default version " +
|
||||
"of .NET Core created by \"dotnet new\"");
|
||||
}
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void WeCoverLatestAspNetCoreAppRollForward()
|
||||
{
|
||||
// Run "dotnet new web", get TargetFramework property, and make sure it's covered in SupportedAspNetCoreAppVersions
|
||||
using (DisposableDirectory directory = Temp.CreateDirectory())
|
||||
{
|
||||
string projectDirectory = directory.Path;
|
||||
|
||||
new NewCommandShim()
|
||||
.WithWorkingDirectory(projectDirectory)
|
||||
.Execute("web --no-restore")
|
||||
.Should().Pass();
|
||||
|
||||
string projectPath = Path.Combine(projectDirectory, Path.GetFileName(projectDirectory) + ".csproj");
|
||||
|
||||
var project = XDocument.Load(projectPath);
|
||||
var ns = project.Root.Name.Namespace;
|
||||
|
||||
string targetFramework = project.Root.Element(ns + "PropertyGroup")
|
||||
.Element(ns + "TargetFramework")
|
||||
.Value;
|
||||
|
||||
SupportedAspNetCoreVersions.Versions.Select(v => $"netcoreapp{v}")
|
||||
.Should().Contain(targetFramework, $"the {nameof(SupportedAspNetCoreVersions)} should include the default version " +
|
||||
"of Microsoft.AspNetCore.App used by the templates created by \"dotnet new web\"");
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,9 +7,9 @@ namespace EndToEnd
|
|||
{
|
||||
public class SupportedNetCoreAppVersions : IEnumerable<object[]>
|
||||
{
|
||||
public IEnumerator<object[]> GetEnumerator() => Versions.GetEnumerator();
|
||||
public IEnumerator<object[]> GetEnumerator() => Versions.Select(version => new object[] { version }).GetEnumerator();
|
||||
IEnumerator IEnumerable.GetEnumerator() => GetEnumerator();
|
||||
public static IEnumerable<object[]> Versions
|
||||
public static IEnumerable<string> Versions
|
||||
{
|
||||
get
|
||||
{
|
||||
|
@ -20,7 +20,23 @@ namespace EndToEnd
|
|||
"2.0",
|
||||
"2.1",
|
||||
"3.0"
|
||||
}.Select(version => new object[] { version });
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
public class SupportedAspNetCoreVersions : IEnumerable<object[]>
|
||||
{
|
||||
public IEnumerator<object[]> GetEnumerator() => Versions.Select(version => new object[] { version }).GetEnumerator();
|
||||
IEnumerator IEnumerable.GetEnumerator() => GetEnumerator();
|
||||
|
||||
public static IEnumerable<string> Versions
|
||||
{
|
||||
get
|
||||
{
|
||||
return SupportedNetCoreAppVersions.Versions.Except(new List<string>() { "1.0", "1.1", "2.0" });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -62,6 +62,17 @@ namespace Microsoft.DotNet.Tools.Test.Utilities
|
|||
return new AndConstraint<CommandResultAssertions>(this);
|
||||
}
|
||||
|
||||
public AndConstraint<CommandResultAssertions> HaveStdOutContainingIgnoreSpaces(string pattern)
|
||||
{
|
||||
string commandResultNoSpaces = _commandResult.StdOut.Replace(" ", "");
|
||||
|
||||
Execute.Assertion
|
||||
.ForCondition(commandResultNoSpaces.Contains(pattern))
|
||||
.FailWith(AppendDiagnosticsTo($"The command output did not contain expected result: {pattern}{Environment.NewLine}"));
|
||||
|
||||
return new AndConstraint<CommandResultAssertions>(this);
|
||||
}
|
||||
|
||||
public AndConstraint<CommandResultAssertions> HaveStdOutContainingIgnoreCase(string pattern)
|
||||
{
|
||||
Execute.Assertion.ForCondition(_commandResult.StdOut.IndexOf(pattern, StringComparison.OrdinalIgnoreCase) >= 0)
|
||||
|
|
|
@ -0,0 +1,24 @@
|
|||
// Copyright (c) .NET Foundation and contributors. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||
|
||||
using Microsoft.DotNet.Cli.Utils;
|
||||
|
||||
namespace Microsoft.DotNet.Tools.Test.Utilities
|
||||
{
|
||||
public sealed class ListPackageCommand : DotnetCommand
|
||||
{
|
||||
private string _path = null;
|
||||
|
||||
public override CommandResult Execute(string args = "")
|
||||
{
|
||||
args = $"list {_path} package {args}";
|
||||
return base.ExecuteWithCapturedOutput(args);
|
||||
}
|
||||
|
||||
public ListPackageCommand WithPath(string path)
|
||||
{
|
||||
_path = path;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue