Skip to content

SQL Server resource does not work on Linux / macOS #15670

@jozefizso

Description

@jozefizso

Is there an existing issue for this?

  • I have searched the existing issues

Describe the bug

I am unable to run a web server with Azure SQL Database resource defined in Aspire apphost (using the TypeScript) on Ubuntu and/or macOS.

Based on the Claude analysis, the issue is caused by the Aspire using the Windows version of the Microsoft.Data.SqlClient.dll library.
It fixed the problem by replacing the file on the disk with the Unix build of the library.

Expected Behavior

The SQL Server resource will start up correctly.

Steps To Reproduce

Use Aspire host defined in TypeScript and add a SQL Server resource. Running the host will fail to start the SQL Server instance.

import { createBuilder, ContainerLifetime } from './.modules/aspire.js'

const builder = await createBuilder()

const sql = await builder.addSqlServer("sql")
    .withLifetime(ContainerLifetime.Persistent)
    .withDataVolume()

const db = await sql.addDatabase("db")

let api = await builder.addProject("api", "./api/api.csproj", "http")
    .withExternalHttpEndpoints()
    .withHttpHealthCheck({ path: "/health" })
    .withReference(db)
    .waitFor(db)

await builder
    .addViteApp("frontend", "./frontend")
    .withExternalHttpEndpoints()
    .withReference(api)
    .waitFor(api)

await builder.build().run();

Run it with aspire run on Ubuntu and/or macOS and observe the SQL instance does not start.

Exceptions (if any)

Failed to create container resource sql
System.PlatformNotSupportedException: Microsoft.Data.SqlClient is not supported on this platform.
at Microsoft.Data.SqlClient.SqlConnectionStringBuilder..ctor()
at Aspire.Hosting.ApplicationModel.SqlServerDatabaseResource.get_ConnectionStringExpression() in //src/Aspire.Hosting.SqlServer/SqlServerDatabaseResource.cs:line 34
at Aspire.Hosting.SqlServerBuilderExtensions.<>c__DisplayClass2_0.<b__1>d.MoveNext() in /
/src/Aspire.Hosting.SqlServer/SqlServerBuilderExtensions.cs:line 137
--- End of stack trace from previous location ---
at Aspire.Hosting.Eventing.DistributedApplicationEventing.<>c__DisplayClass5_01.<<Subscribe>b__0>d.MoveNext() in /_/src/Aspire.Hosting/Eventing/DistributedApplicationEventing.cs:line 112 --- End of stack trace from previous location --- at Aspire.Hosting.Eventing.DistributedApplicationEventing.<>c__DisplayClass4_01.<b__0>d.MoveNext() in //src/Aspire.Hosting/Eventing/DistributedApplicationEventing.cs:line 82
--- End of stack trace from previous location ---
at Aspire.Hosting.Eventing.DistributedApplicationEventing.PublishAsync[T](T event, EventDispatchBehavior dispatchBehavior, CancellationToken cancellationToken) in /
/src/Aspire.Hosting/Eventing/DistributedApplicationEventing.cs:line 69
at Aspire.Hosting.Orchestrator.ApplicationOrchestrator.PublishConnectionStringAvailableEvent(IResource resource, CancellationToken cancellationToken) in //src/Aspire.Hosting/Orchestrator/ApplicationOrchestrator.cs:line 668
at Aspire.Hosting.Orchestrator.ApplicationOrchestrator.PublishConnectionStringAvailableEvent(IResource resource, CancellationToken cancellationToken) in /
/src/Aspire.Hosting/Orchestrator/ApplicationOrchestrator.cs:line 683
at Aspire.Hosting.Orchestrator.ApplicationOrchestrator.OnResourceStarting(OnResourceStartingContext context) in //src/Aspire.Hosting/Orchestrator/ApplicationOrchestrator.cs:line 196
at Aspire.Hosting.Dcp.DcpExecutorEvents.PublishAsync[T](T context) in /
/src/Aspire.Hosting/Dcp/DcpExecutorEvents.cs:line 33
at Aspire.Hosting.Dcp.DcpExecutor.CreateContainerAsync(RenderedModelResource cr, ILogger resourceLogger, CancellationToken cancellationToken) in //src/Aspire.Hosting/Dcp/DcpExecutor.cs:line 2043
at Aspire.Hosting.Dcp.DcpExecutor.<>c__DisplayClass82_0.<g__CreateContainerAsyncCore|0>d.MoveNext() in /
/src/Aspire.Hosting/Dcp/DcpExecutor.cs:line 1980

.NET Version info

.NET SDK:
 Version:           10.0.201
 Commit:            4d3023de60
 Workload version:  10.0.200-manifests.0793c108
 MSBuild version:   18.3.0-release-26153-122+4d3023de6

Runtime Environment:
 OS Name:     Mac OS X
 OS Version:  15.7
 OS Platform: Darwin
 RID:         osx-arm64
 Base Path:   /usr/local/share/dotnet/sdk/10.0.201/

.NET workloads installed:
There are no installed workloads to display.
Configured to use workload sets when installing new manifests.
No workload sets are installed. Run "dotnet workload restore" to install a workload set.

Host:
  Version:      10.0.5
  Architecture: arm64
  Commit:       a612c2a105

.NET SDKs installed:
  8.0.416 [/usr/local/share/dotnet/sdk]
  9.0.308 [/usr/local/share/dotnet/sdk]
  10.0.201 [/usr/local/share/dotnet/sdk]

.NET runtimes installed:
  Microsoft.AspNetCore.App 8.0.22 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 9.0.11 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 10.0.5 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 8.0.22 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
  Microsoft.NETCore.App 9.0.11 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
  Microsoft.NETCore.App 10.0.5 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]

Other architectures found:
  None

Environment variables:
  Not set

global.json file:
  Not found

Anything else?

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions