Add an overload that takes the application base path explicitly
This commit is contained in:
parent
e892ed8bbd
commit
fc613303ed
|
|
@ -53,13 +53,25 @@ namespace Microsoft.AspNetCore.TestHost
|
||||||
this IWebHostBuilder builder,
|
this IWebHostBuilder builder,
|
||||||
string solutionRelativePath,
|
string solutionRelativePath,
|
||||||
string solutionName = "*.sln")
|
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)
|
if (solutionRelativePath == null)
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException(nameof(solutionRelativePath));
|
throw new ArgumentNullException(nameof(solutionRelativePath));
|
||||||
}
|
}
|
||||||
|
|
||||||
var applicationBasePath = AppContext.BaseDirectory;
|
if (applicationBasePath == null)
|
||||||
|
{
|
||||||
|
throw new ArgumentNullException(nameof(applicationBasePath));
|
||||||
|
}
|
||||||
|
|
||||||
var directoryInfo = new DirectoryInfo(applicationBasePath);
|
var directoryInfo = new DirectoryInfo(applicationBasePath);
|
||||||
do
|
do
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue