Skip to content

Commit eabe6af

Browse files
authored
Add special case for GetDocument.Insider invocation (#2011)
1 parent 7078bda commit eabe6af

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed
Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,14 @@
1-
namespace Microsoft.Extensions.Hosting;
1+
using System.Reflection;
2+
3+
namespace Microsoft.Extensions.Hosting;
24

35
internal static class HostEnvironmentExtensions
46
{
5-
public static bool IsBuild(this IHostEnvironment hostEnvironment) => hostEnvironment.IsEnvironment("Build");
7+
public static bool IsBuild(this IHostEnvironment hostEnvironment)
8+
{
9+
// Check if the environment is "Build" or the entry assembly is "GetDocument.Insider"
10+
// to account for scenarios where app is launching via OpenAPI build-time generation
11+
// via the GetDocument.Insider tool.
12+
return hostEnvironment.IsEnvironment("Build") || Assembly.GetEntryAssembly()?.GetName().Name == "GetDocument.Insider";
13+
}
614
}

0 commit comments

Comments
 (0)