From fc613303ed1598ebf8a761aa54b8076f8dd905cf Mon Sep 17 00:00:00 2001 From: Javier Calvarro Nelson Date: Tue, 31 Oct 2017 11:02:48 -0700 Subject: [PATCH] Add an overload that takes the application base path explicitly --- .../WebHostBuilderExtensions.cs | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/Microsoft.AspNetCore.TestHost/WebHostBuilderExtensions.cs b/src/Microsoft.AspNetCore.TestHost/WebHostBuilderExtensions.cs index 4c45c9feb9..770ac3d3b1 100644 --- a/src/Microsoft.AspNetCore.TestHost/WebHostBuilderExtensions.cs +++ b/src/Microsoft.AspNetCore.TestHost/WebHostBuilderExtensions.cs @@ -53,13 +53,25 @@ namespace Microsoft.AspNetCore.TestHost this IWebHostBuilder builder, string solutionRelativePath, string solutionName = "*.sln") + { + return builder.UseSolutionRelativeContentRoot(solutionRelativePath, AppContext.BaseDirectory, solutionName); + } + + public static IWebHostBuilder UseSolutionRelativeContentRoot( + this IWebHostBuilder builder, + string solutionRelativePath, + string applicationBasePath, + string solutionName = "*.sln") { if (solutionRelativePath == null) { throw new ArgumentNullException(nameof(solutionRelativePath)); } - var applicationBasePath = AppContext.BaseDirectory; + if (applicationBasePath == null) + { + throw new ArgumentNullException(nameof(applicationBasePath)); + } var directoryInfo = new DirectoryInfo(applicationBasePath); do