You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It seems IHostingEnvironment.ApplicationName is always used during integration tests even if I have defined on my appsettings an entry of ApplicationName
I believe this is set via the command line args (automatically by the framework) when running the tests and overriding it via UseSettings with the value from your config, app will throw a FileNotFoundException which makes sense.
Running the app normally seems fine since the command line args is empty anyway
For context, the value on my config is just a generic description of the app (e.g. MyApp), not using minimal API but using top-level statement. Also using .NET6 and ASPNETCore 6
Already seen #11085, #7315, #34914 but none of them work for my scenario
I have tried using WebApplication.CreateBuilder() (without the args) however, it will always use Production settings on integration tests
Thanks for the repro project! The good news is that the desired value is present. The bad news is that it's lower priority than the other value (I'm not yet sure why).
Facing exactly the same problem.
Is there any point to set ApplicationName configuration to the assembly name in the testing?
And has anyone found a way to fix this for integration tests?
Is there an existing issue for this?
Describe the bug
It seems
IHostingEnvironment.ApplicationName
is always used during integration tests even if I have defined on myappsettings
an entry ofApplicationName
I believe this is set via the command line args (automatically by the framework) when running the tests and overriding it via
UseSettings
with the value from your config, app will throw aFileNotFoundException
which makes sense.Running the app normally seems fine since the command line args is empty anyway
For context, the value on my config is just a generic description of the app (e.g. MyApp), not using minimal API but using top-level statement. Also using .NET6 and ASPNETCore 6
Already seen #11085, #7315, #34914 but none of them work for my scenario
I have tried using
WebApplication.CreateBuilder()
(without the args) however, it will always use Production settings on integration testsIs there a proper way to override this?
Expected Behavior
Value from appsettings should be used
Steps To Reproduce
https://github.com/glennfordd/OverrideApplicationName
Exceptions (if any)
No response
.NET Version
6
Anything else?
No response
The text was updated successfully, but these errors were encountered: