From 9ade9da2f75ad509a60a1e501237888aa856b79b Mon Sep 17 00:00:00 2001 From: John Luo Date: Mon, 14 Mar 2016 10:31:08 -0700 Subject: [PATCH] Revert ApplicationBasePath default resolution #641 --- .../WebHostBuilder.cs | 17 ----------------- .../WebHostBuilderTests.cs | 6 ------ 2 files changed, 23 deletions(-) diff --git a/src/Microsoft.AspNetCore.Hosting/WebHostBuilder.cs b/src/Microsoft.AspNetCore.Hosting/WebHostBuilder.cs index 3f272a66ac..7443f24c76 100644 --- a/src/Microsoft.AspNetCore.Hosting/WebHostBuilder.cs +++ b/src/Microsoft.AspNetCore.Hosting/WebHostBuilder.cs @@ -230,23 +230,6 @@ namespace Microsoft.AspNetCore.Hosting private string ResolveApplicationBasePath(string applicationBasePath, string basePath) { - if (_startup != null) - { - var startupAssemblyLocation = _startup.ConfigureDelegate.Target.GetType().GetTypeInfo().Assembly.Location; - if (!string.IsNullOrEmpty(startupAssemblyLocation)) - { - return Path.GetDirectoryName(startupAssemblyLocation); - } - } - else if (_startupType != null) - { - var startupAssemblyLocation = _startupType.GetTypeInfo().Assembly.Location; - if (!string.IsNullOrEmpty(startupAssemblyLocation)) - { - return Path.GetDirectoryName(startupAssemblyLocation); - } - } - if (string.IsNullOrEmpty(applicationBasePath)) { return basePath; diff --git a/test/Microsoft.AspNetCore.Hosting.Tests/WebHostBuilderTests.cs b/test/Microsoft.AspNetCore.Hosting.Tests/WebHostBuilderTests.cs index 7c24576631..f5c7bc6054 100644 --- a/test/Microsoft.AspNetCore.Hosting.Tests/WebHostBuilderTests.cs +++ b/test/Microsoft.AspNetCore.Hosting.Tests/WebHostBuilderTests.cs @@ -352,12 +352,10 @@ namespace Microsoft.AspNetCore.Hosting var host = new WebHostBuilder() .UseServer(new TestServer()) .UseStartup("Microsoft.AspNetCore.Hosting.Tests") - .UseApplicationBasePath("/foo/bar") .Build(); var appEnv = host.Services.GetService(); Assert.Equal("Microsoft.AspNetCore.Hosting.Tests", appEnv.ApplicationName); - Assert.Equal("/foo/bar", appEnv.ApplicationBasePath); } [Fact] @@ -368,12 +366,10 @@ namespace Microsoft.AspNetCore.Hosting .UseServer(new TestServer()) .UseStartup() .UseStartup("Microsoft.AspNetCore.Hosting.Tests.NonExistent") - .UseApplicationBasePath("/foo/bar") .Build(); var appEnv = host.Services.GetService(); Assert.Equal("Microsoft.AspNetCore.Hosting.Tests", appEnv.ApplicationName); - Assert.Equal(Path.GetDirectoryName(typeof(WebHostBuilderTests).GetTypeInfo().Assembly.Location), appEnv.ApplicationBasePath); } [Fact] @@ -384,12 +380,10 @@ namespace Microsoft.AspNetCore.Hosting .UseServer(new TestServer()) .Configure(app => { }) .UseStartup("Microsoft.AspNetCore.Hosting.Tests.NonExistent") - .UseApplicationBasePath("/foo/bar") .Build(); var appEnv = host.Services.GetService(); Assert.Equal("Microsoft.AspNetCore.Hosting.Tests", appEnv.ApplicationName); - Assert.Equal(Path.GetDirectoryName(typeof(WebHostBuilderTests).GetTypeInfo().Assembly.Location), appEnv.ApplicationBasePath); } private IWebHostBuilder CreateWebHostBuilder()