I have some old applications that I am progressively migrating to .Net 6.0.
I have used Microsoft Upgrade Assistant, it works well. My application still references DLLs in older framework version though, but runs well.
The configuration uses the old XML format with appsettings section. As the configuration maybe pretty complicated, I will not rewrite all configurations files in JSON for now, I would like to stick to XML format for a while.
The main application itself (EXE) runs well and finds it configuration, my problem is for unit tests.
At test startup in R#, the configuration is not visible : ConfigurationManager returns nothing for AppSettings.
I am using VS2022 17.2.3, NUnit 3.13.3 (last version), Resharper 2022.1.2 (last version).
For an EXE, in .Net 6.0, i have the EXE itself (let's say Main.EXE), a DLL with the same name (Main.DLL), and a configuration file named Main.dll.config automatically produced from App.config defined in project. This works as expected.
For a Unit test project, it's close : A Main.dll, a Main.dll.config, and some testhost.exe and testhost.dll files. The configuration file is ignored, this is my problem. Before the migration, this was ok for both exe and unit test.
The code to read and load it is exactly the same for the unit test and the normal exe.
Any suggestions please to fix this issue with unit test ?