From 354da29640a5f20ecc109834bb7759b73c38f66b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Magnus=20S=C3=B8rensen?= Date: Tue, 1 Sep 2026 22:21:39 +0200 Subject: [PATCH] Fix load of env vars for dataverse connection --- .../Configuration/AppSettingsConfigBuilder.cs | 2 ++ src/XrmDefinitelyTyped.Tool/Program.cs | 4 ++-- src/XrmDefinitelyTyped.Tool/XrmDefinitelyTyped.Tool.csproj | 1 + 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/XrmDefinitelyTyped.Tool/Configuration/AppSettingsConfigBuilder.cs b/src/XrmDefinitelyTyped.Tool/Configuration/AppSettingsConfigBuilder.cs index 1d6694168e..48fbab2a64 100644 --- a/src/XrmDefinitelyTyped.Tool/Configuration/AppSettingsConfigBuilder.cs +++ b/src/XrmDefinitelyTyped.Tool/Configuration/AppSettingsConfigBuilder.cs @@ -8,6 +8,8 @@ public static IConfiguration BuildConfiguration() => new ConfigurationBuilder() .SetBasePath(Directory.GetCurrentDirectory()) .AddJsonFile("appsettings.json", optional: true) + .AddJsonFile($"appsettings.{Environment.GetEnvironmentVariable("DOTNET_ENVIRONMENT") ?? "Production"}.json", optional: true) + .AddEnvironmentVariables() .Build(); public static PartialConfig BuildFromConfiguration(IConfiguration configuration) diff --git a/src/XrmDefinitelyTyped.Tool/Program.cs b/src/XrmDefinitelyTyped.Tool/Program.cs index d3470684af..3d5fdc76ac 100644 --- a/src/XrmDefinitelyTyped.Tool/Program.cs +++ b/src/XrmDefinitelyTyped.Tool/Program.cs @@ -41,8 +41,8 @@ // Authentication is handled by the DataverseConnection package, which reads its settings from the // IConfiguration registered below: DATAVERSE_URL for the environment, and DATAVERSE_CREDENTIAL_TYPE - // to pick the credential (browser, devicecode, azcli, ...). Defaults to DefaultAzureCredential, - // whose chain includes the caller's Azure CLI session (`az login`). + // to pick the credential (browser, devicecode, azcli, ...). Browser and device-code credentials + // use DataverseConnection's persistent token cache when their option objects remain unset. var services = new ServiceCollection(); services.AddSingleton(configuration); services.AddDataverse(); diff --git a/src/XrmDefinitelyTyped.Tool/XrmDefinitelyTyped.Tool.csproj b/src/XrmDefinitelyTyped.Tool/XrmDefinitelyTyped.Tool.csproj index 5e44ef4049..92a8a764f1 100644 --- a/src/XrmDefinitelyTyped.Tool/XrmDefinitelyTyped.Tool.csproj +++ b/src/XrmDefinitelyTyped.Tool/XrmDefinitelyTyped.Tool.csproj @@ -34,6 +34,7 @@ +