From d6d0130942741f04c03947d5b52bee7a7df430d2 Mon Sep 17 00:00:00 2001 From: Nick Guerrera Date: Fri, 27 Jul 2018 15:01:22 -0700 Subject: [PATCH] Fix test issues --- .../dotnet-dependency-tool-invoker.csproj | 1 + .../TestProjects/TestAppSimple/Program.cs | 23 +++++++++++++ .../TestAppSimple/TestAppSimple.csproj | 8 +++++ build/MSBuildExtensions.targets | 1 + .../GivenAspNetAppsResolveImplicitVersions.cs | 3 ++ .../GivenSelfContainedAppsRollForward.cs | 33 +++---------------- 6 files changed, 40 insertions(+), 29 deletions(-) create mode 100644 TestAssets/TestProjects/TestAppSimple/Program.cs create mode 100644 TestAssets/TestProjects/TestAppSimple/TestAppSimple.csproj diff --git a/TestAssets/TestPackages/dotnet-dependency-tool-invoker/dotnet-dependency-tool-invoker.csproj b/TestAssets/TestPackages/dotnet-dependency-tool-invoker/dotnet-dependency-tool-invoker.csproj index 758e81ed5..8f6e579e7 100644 --- a/TestAssets/TestPackages/dotnet-dependency-tool-invoker/dotnet-dependency-tool-invoker.csproj +++ b/TestAssets/TestPackages/dotnet-dependency-tool-invoker/dotnet-dependency-tool-invoker.csproj @@ -6,6 +6,7 @@ $(CliTargetFramework) Exe + $(MicrosoftNETCoreAppPackageVersion) diff --git a/TestAssets/TestProjects/TestAppSimple/Program.cs b/TestAssets/TestProjects/TestAppSimple/Program.cs new file mode 100644 index 000000000..d431e919c --- /dev/null +++ b/TestAssets/TestProjects/TestAppSimple/Program.cs @@ -0,0 +1,23 @@ +// 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 System; + +namespace ConsoleApplication +{ + public class Program + { + public static void Main(string[] args) + { + Console.WriteLine("Hello World!"); + + if (args.Length > 0) + { + for (int i = 0; i < args.Length; i++) + { + Console.WriteLine($"{i} = {args[i]}"); + } + } + } + } +} diff --git a/TestAssets/TestProjects/TestAppSimple/TestAppSimple.csproj b/TestAssets/TestProjects/TestAppSimple/TestAppSimple.csproj new file mode 100644 index 000000000..7f72f6294 --- /dev/null +++ b/TestAssets/TestProjects/TestAppSimple/TestAppSimple.csproj @@ -0,0 +1,8 @@ + + + + + netcoreapp2.2 + Exe + + \ No newline at end of file diff --git a/build/MSBuildExtensions.targets b/build/MSBuildExtensions.targets index 691b04388..47405fe76 100644 --- a/build/MSBuildExtensions.targets +++ b/build/MSBuildExtensions.targets @@ -113,6 +113,7 @@ Copyright (c) .NET Foundation. All rights reserved. 1.0.12 1.1.9 2.0.9 + 2.1.2 ]]> diff --git a/test/EndToEnd/GivenAspNetAppsResolveImplicitVersions.cs b/test/EndToEnd/GivenAspNetAppsResolveImplicitVersions.cs index a5d99468d..9e3850e74 100644 --- a/test/EndToEnd/GivenAspNetAppsResolveImplicitVersions.cs +++ b/test/EndToEnd/GivenAspNetAppsResolveImplicitVersions.cs @@ -48,6 +48,9 @@ namespace EndToEnd var restoredVersion = GetAspNetCoreAppVersion(assetsFile, portable: true); restoredVersion.Should().NotBeNull(); + var bundledVersionPath = Path.Combine(projectDirectory, ".BundledAspNetCoreVersion"); + var bundledVersion = File.ReadAllText(bundledVersionPath).Trim(); + restoredVersion.ToNormalizedString().Should().BeEquivalentTo(bundledVersion, "The bundled aspnetcore versions set in Microsoft.NETCoreSdk.BundledVersions.props should be idenitical to the versions set in DependencyVersions.props." + "Please update MSBuildExtensions.targets in this repo so these versions match."); diff --git a/test/EndToEnd/GivenSelfContainedAppsRollForward.cs b/test/EndToEnd/GivenSelfContainedAppsRollForward.cs index 859aa4eb6..33c806128 100644 --- a/test/EndToEnd/GivenSelfContainedAppsRollForward.cs +++ b/test/EndToEnd/GivenSelfContainedAppsRollForward.cs @@ -1,4 +1,5 @@ using System; +using System.Collections.Generic; using System.IO; using System.Linq; using System.Runtime.InteropServices; @@ -22,8 +23,9 @@ namespace EndToEnd [ClassData(typeof(SupportedNetCoreAppVersions))] public void ItRollsForwardToTheLatestVersion(string minorVersion) { - // https://github.com/dotnet/cli/issues/9661: remove this once the ASP.NET version bump - // merges from 2.1.3xx -> 2.1.4xx -> 2.2.1xx + // 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; @@ -132,32 +134,5 @@ namespace EndToEnd } } - public static IEnumerable SupportedNetCoreAppVersions - { - get - { - - var versions = new List(); - - // Runtime 1.x deosn't support openSUSE and Fedora 27, so skip testing those versions on Linux - if (!RuntimeInformation.IsOSPlatform(OSPlatform.Linux)) - { - versions.AddRange(new[] - { - "1.0", - "1.1", - }); - } - - versions.AddRange(new[] - { - "2.0", - "2.1", - "3.0" - }); - - return versions.Select(version => new object[] { version }); - } - } } }