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
{{ message }}
Repository navigation
Connection string is not available when using the new simplified build folder structure #62
When I enable this in my projects, I start getting the error:
System.InvalidOperationException : You are missing a connection string of name 'UnitTestConnection' in the appsettings.json file.
This is the only issue I've encountered with the new setting. I've confirmed that the appsettings.json file is copied to the correct output directory alongside my testing project assembly. I can manually load the settings file as shown below, and the following test passes, but my tests that use EfCore.TestSupport don't seem to load any of the settings.
changed the title [-]Connection string is not availalbe when using the new simplified build folder structure[/-][+]Connection string is not available when using the new simplified build folder structure[/+]on Jan 8, 2026
After a little more testing, I've figured out that EfCore.TestSupport works if the appsettings.json file is located in the root of the new folder structure:
📁 artifacts ← TestSupport looks for "appsettings.json" here.
└──📂 <Type of output>
└──📂 <Project name>
└──📂 <Pivot> ← Testing assembly is here.
I can work around this issue for now by copying the settings file to the root artifacts folder, but this is counter to expectations and could result in a conflict if more than one test project exists with different settings files.
For anyone else with this issue, adding something like the following to your test's csproj file will copy the settings file where you need it, but you might have to adjust the path depending on your project folder layout.
Activity
[-]Connection string is not availalbe when using the new simplified build folder structure[/-][+]Connection string is not available when using the new simplified build folder structure[/+]dougwaldron commentedon Jan 8, 2026
After a little more testing, I've figured out that
EfCore.TestSupportworks if the appsettings.json file is located in the root of the new folder structure:I can work around this issue for now by copying the settings file to the root artifacts folder, but this is counter to expectations and could result in a conflict if more than one test project exists with different settings files.
dougwaldron commentedon Jan 8, 2026
For anyone else with this issue, adding something like the following to your test's csproj file will copy the settings file where you need it, but you might have to adjust the path depending on your project folder layout.
On the other hand, if this issue can be fixed, the following would work instead, and wouldn't depend on the project layout.