Add an overload that takes the application base path explicitly

This commit is contained in:
Javier Calvarro Nelson 2017-10-31 11:02:48 -07:00
Родитель e892ed8bbd
Коммит fc613303ed
1 изменённых файлов: 13 добавлений и 1 удалений

Просмотреть файл

@ -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