diff --git a/eng/TestVersions.props b/eng/TestVersions.props index c66ffded4..0406a5668 100644 --- a/eng/TestVersions.props +++ b/eng/TestVersions.props @@ -4,7 +4,7 @@ 3.0.100-alpha1-20180711-1 0.1.1 15.8.0 - 3.0.0-preview-27106-02 + 3.0.0-preview-27109-05 1.3.1 diff --git a/eng/Versions.props b/eng/Versions.props index 5c2162273..268e7cf87 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -17,7 +17,7 @@ - 3.0.0-preview-27106-02 + 3.0.0-preview-27109-05 $(MicrosoftNETCoreAppPackageVersion) diff --git a/old/build/MSBuildExtensions.targets b/old/build/MSBuildExtensions.targets index 11a5e278d..0339dbe1b 100644 --- a/old/build/MSBuildExtensions.targets +++ b/old/build/MSBuildExtensions.targets @@ -74,7 +74,7 @@ + LatestVersion="2.1.6" /> + LatestVersion="2.1.6"/> + LatestVersion="2.1.6"/> @@ -164,7 +164,7 @@ Copyright (c) .NET Foundation. All rights reserved. TargetingPackVersion="$(MicrosoftDesktopUIPackageVersion)" /> - + { + public IEnumerator GetEnumerator() => Versions.Select(version => new object[] { version }).GetEnumerator(); + IEnumerator IEnumerable.GetEnumerator() => GetEnumerator(); + + public static IEnumerable Versions + { + get + { + return SupportedAspNetCoreVersions.Versions.Where(v => new Version(v).Major < 3); + } + } + } } diff --git a/test/EndToEnd/TestProjectCreator.cs b/test/EndToEnd/TestProjectCreator.cs new file mode 100644 index 000000000..bbb8805eb --- /dev/null +++ b/test/EndToEnd/TestProjectCreator.cs @@ -0,0 +1,80 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Runtime.CompilerServices; +using System.Text; +using System.Xml.Linq; +using Microsoft.DotNet.TestFramework; +using Microsoft.DotNet.Tools.Test.Utilities; + +namespace EndToEnd +{ + class TestProjectCreator + { + public const string NETCorePackageName = "Microsoft.NETCore.App"; + public const string AspNetCoreAppPackageName = "Microsoft.AspNetCore.App"; + public const string AspNetCoreAllPackageName = "Microsoft.AspNetCore.All"; + + + public string TestName { get; set; } + public string Identifier { get; set; } + + public string PackageName { get; set; } = NETCorePackageName; + + public string MinorVersion { get; set; } + + public string RuntimeIdentifier { get; set; } + + public TestProjectCreator([CallerMemberName] string testName = null, string identifier = "") + { + TestName = testName; + Identifier = identifier; + } + + public TestAssetInstance Create() + { + var testInstance = TestBase.TestAssets.Get("TestAppSimple") + .CreateInstance(callingMethod: TestName, identifier: Identifier + PackageName + "_" + MinorVersion) + .WithSourceFiles(); + + string projectDirectory = testInstance.Root.FullName; + + string projectPath = Path.Combine(projectDirectory, "TestAppSimple.csproj"); + + var project = XDocument.Load(projectPath); + var ns = project.Root.Name.Namespace; + + // Update TargetFramework to the right version of .NET Core + project.Root.Element(ns + "PropertyGroup") + .Element(ns + "TargetFramework") + .Value = "netcoreapp" + MinorVersion; + + if (!string.IsNullOrEmpty(RuntimeIdentifier)) + { + project.Root.Element(ns + "PropertyGroup") + .Add(new XElement(ns + "RuntimeIdentifier", RuntimeIdentifier)); + } + + + if (PackageName != NETCorePackageName) + { + if (new Version(MinorVersion).Major < 3) + { + // Add ASP.NET PackageReference with implicit version for target framework versions prior to 3.0 + project.Root.Add(new XElement(ns + "ItemGroup", + new XElement(ns + "PackageReference", new XAttribute("Include", PackageName)))); + } + else + { + project.Root.Add(new XElement(ns + "ItemGroup", + new XElement(ns + "FrameworkReference", new XAttribute("Include", PackageName)))); + } + } + + project.Save(projectPath); + + return testInstance; + + } + } +} diff --git a/test/Microsoft.DotNet.Tools.Tests.Utilities/TestBase.cs b/test/Microsoft.DotNet.Tools.Tests.Utilities/TestBase.cs index b2a8dcb29..7c6740d78 100644 --- a/test/Microsoft.DotNet.Tools.Tests.Utilities/TestBase.cs +++ b/test/Microsoft.DotNet.Tools.Tests.Utilities/TestBase.cs @@ -42,7 +42,7 @@ namespace Microsoft.DotNet.Tools.Test.Utilities } } - protected static TestAssets TestAssets + public static TestAssets TestAssets { get {