-
Notifications
You must be signed in to change notification settings - Fork 57
Open
Description
.NET 8 introduced a new simplified output path and folder structure for build outputs. The new format is opt-in by adding the following to the Directory.Build.props file:
<PropertyGroup>
<UseArtifactsOutput>true</UseArtifactsOutput>
</PropertyGroup>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.
[Test]
public void AppSettingsIsLoaded()
{
var config = new ConfigurationBuilder()
.SetBasePath(AppDomain.CurrentDomain.BaseDirectory)
.AddJsonFile("appsettings.json", optional: false)
.Build();
var value = config["Test"];
value.Should().NotBeNull();
}Metadata
Metadata
Assignees
Labels
No labels