C3D.Extensions.Aspire.Fluent 0.2.6

dotnet add package C3D.Extensions.Aspire.Fluent --version 0.2.6
                    
NuGet\Install-Package C3D.Extensions.Aspire.Fluent -Version 0.2.6
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="C3D.Extensions.Aspire.Fluent" Version="0.2.6" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="C3D.Extensions.Aspire.Fluent" Version="0.2.6" />
                    
Directory.Packages.props
<PackageReference Include="C3D.Extensions.Aspire.Fluent" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add C3D.Extensions.Aspire.Fluent --version 0.2.6
                    
#r "nuget: C3D.Extensions.Aspire.Fluent, 0.2.6"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#addin nuget:?package=C3D.Extensions.Aspire.Fluent&version=0.2.6
                    
Install C3D.Extensions.Aspire.Fluent as a Cake Addin
#tool nuget:?package=C3D.Extensions.Aspire.Fluent&version=0.2.6
                    
Install C3D.Extensions.Aspire.Fluent as a Cake Tool

C3D.Extensions.Aspire.Fluent

Key Functions

  • Environment-based Configuration Easily apply different configurations depending on the hosting environment (e.g., Development, Staging, Production).
  • Operation Mode Detection Adjust host behavior based on the current operation mode, such as Run, Publish, or Inspect.
  • Test Environment Awareness Automatically detect if the host is running under test conditions (by checking for the presence of the Aspire.Hosting.Testing assembly in the call stack) and apply test-specific settings.

Usage Example

Suppose you want to configure services differently for development and production:

        var sqldb = builder.WhenDevelopment(b => b.AddSqlServer("sql").AddDatabase("sqldb"));
        builder.AddProject<Projects.MyWebApp>("webapp")
            .WhenDevelopment(r => r.WithReference(sqldb!, "sqldb")
                                   .WaitFor(sqldb!),
                             r => r.WithEnvironment("ConnectionString_sqldb","data source=(localdb)\mssqllocaldb;initial catalog=webapp;integrated security=True;MultipleActiveResultSets=True;App=webapp"));

For most of the methods, there is an else case (which is optional), and extension methods for IResourceBuilder and IDistributedApplicationBuilder

You can also nest methods, e.g. WhenUnderTest inside the lambda of WhenDevelopment.

If you want to only use the 'else' case, you can simply return the resourceBuilder or null in the match function.

    var sqldb = builder.WhenProduction(_ => null, b => b.AddSqlServer("sql").AddDatabase("sqldb"));
    builder.AddProject<Projects.MyWebApp>("webapp")
        .WhenProduction(r => r,
                        r => r.WithReference(sqldb!, "sqldb")
                              .WaitFor(sqldb!));

In the case of UnitTesting, there are explicit WhenNotUnderTest methods which read more cleanly than WhenUnderTest(r=>r, r=>r.... ).

Note: For detailed API documentation and advanced usage, refer to the source code or inline XML comments within the project.

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 is compatible.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on C3D.Extensions.Aspire.Fluent:

Package Downloads
C3D.Extensions.Aspire.VisualStudioDebug

Assembly Version: 0.1.0.0 File Version: 0.1.43.15317 Informational Version: 0.1.43+d53b3e62e2 Build Configuration: Release

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
0.2.6 250 5/12/2025