From 424024ad0c30f7c6a4be4a8cf51d3998d3044ed5 Mon Sep 17 00:00:00 2001 From: Daniel Plaisted Date: Mon, 7 Jan 2019 13:55:18 -0800 Subject: [PATCH] Update .NET Core version, and add test to catch when ASP.NET depends on a later version than we have Fixes https://github.com/dotnet/cli/issues/10553 --- eng/Versions.props | 2 +- test/EndToEnd/ProjectBuildTests.cs | 44 ++++++++++++++++++++++++++++++ 2 files changed, 45 insertions(+), 1 deletion(-) diff --git a/eng/Versions.props b/eng/Versions.props index a8df7ff28..8e7e2ff4c 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -28,7 +28,7 @@ $(MicrosoftAspNetCoreAppPackageVersion) - 3.0.0-preview-27218-01 + 3.0.0-preview-27219-3 $(MicrosoftNETCoreAppPackageVersion) diff --git a/test/EndToEnd/ProjectBuildTests.cs b/test/EndToEnd/ProjectBuildTests.cs index d7ee2553e..d3717b7ba 100644 --- a/test/EndToEnd/ProjectBuildTests.cs +++ b/test/EndToEnd/ProjectBuildTests.cs @@ -61,6 +61,50 @@ namespace EndToEnd.Tests binDirectory.Should().NotHaveFilesMatching("*.dll", SearchOption.AllDirectories); } + [Fact] + public void ItCanRunAnAppUsingTheWebSdk() + { + var directory = TestAssets.CreateTestDirectory(); + string projectDirectory = directory.FullName; + + string newArgs = "console --debug:ephemeral-hive --no-restore"; + new NewCommandShim() + .WithWorkingDirectory(projectDirectory) + .Execute(newArgs) + .Should().Pass(); + + string projectPath = Path.Combine(projectDirectory, directory.Name + ".csproj"); + + var project = XDocument.Load(projectPath); + var ns = project.Root.Name.Namespace; + + project.Root.Attribute("Sdk").Value = "Microsoft.NET.Sdk.Web"; + + project.Save(projectPath); + + new BuildCommand() + .WithWorkingDirectory(projectDirectory) + .Execute() + .Should().Pass(); + + var runCommand = new RunCommand() + .WithWorkingDirectory(projectDirectory); + + // Set DOTNET_ROOT as workaround for https://github.com/dotnet/cli/issues/10196 + var dotnetRoot = Path.GetDirectoryName(RepoDirectoriesProvider.DotnetUnderTest); + if (!string.IsNullOrEmpty(dotnetRoot)) + { + bool useX86 = RepoDirectoriesProvider.DotnetRidUnderTest.EndsWith("x86", StringComparison.InvariantCultureIgnoreCase); + runCommand = runCommand.WithEnvironmentVariable(useX86 ? "DOTNET_ROOT(x86)" : "DOTNET_ROOT", + dotnetRoot); + } + + runCommand.ExecuteWithCapturedOutput() + .Should().Pass() + .And.HaveStdOutContaining("Hello World!"); + + } + [Theory] [InlineData("console")] [InlineData("classlib")]