Purview.Containers.MsSql
1.0.0-prerelease.5
This is a prerelease version of Purview.Containers.MsSql.
dotnet add package Purview.Containers.MsSql --version 1.0.0-prerelease.5
NuGet\Install-Package Purview.Containers.MsSql -Version 1.0.0-prerelease.5
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="Purview.Containers.MsSql" Version="1.0.0-prerelease.5" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Purview.Containers.MsSql" Version="1.0.0-prerelease.5" />
<PackageReference Include="Purview.Containers.MsSql" />
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 Purview.Containers.MsSql --version 1.0.0-prerelease.5
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Purview.Containers.MsSql, 1.0.0-prerelease.5"
#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.
#:package Purview.Containers.MsSql@1.0.0-prerelease.5
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Purview.Containers.MsSql&version=1.0.0-prerelease.5&prerelease
#tool nuget:?package=Purview.Containers.MsSql&version=1.0.0-prerelease.5&prerelease
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
Purview.Containers.MsSql
Throwaway Microsoft SQL Server databases for .NET integration testing on WSL Containers (WSLC) or Docker.
dotnet add package Purview.Containers.MsSql
Backend-neutral: depends on Purview.Containers.Core and needs a backend package (Purview.Containers.Wsl or Purview.Containers.Docker) and brings Microsoft.Data.SqlClient for
connection-string generation and readiness probing.
Requirements
- WSL Containers backend: Windows 10/11 with WSL Containers (
wsl --install --no-distribution), and a.NET 10or later project. A platform-neutralnet10.0project binds the portable facade and gets automatic WSLC-or-Docker selection; a Windows target framework (net10.0-windows10.0.19041.0, x64 or arm64) binds the implementation directly. ThePurview.Containers.Wslpackage suppliesbuildTransitivedefaults forWindowsSdkPackageVersion/PlatformTargetand (for a platform-neutral consumer on a Windows build host) the implementation payload, rejecting an unsupported consumer withPCC0001/PCC0002— see the consumer requirements. - Docker backend: any reachable Docker daemon (
docker info), with anet10.0or later project on any platform. No Windows target framework and noPCCguards apply. - Experimental: the API, defaults and packaging can change between prereleases; there is no production support guarantee.
Quick start
using Microsoft.Data.SqlClient;
using Purview.Containers.MsSql;
await using var sqlServer = new MsSqlBuilder()
.WithPassword("SomeStrong!Password1")
.AcceptLicense() // explicit EULA acceptance is required
.Build();
await sqlServer.StartAsync(); // waits for a real SQL Server connection
await using var connection = new SqlConnection(sqlServer.GetConnectionString());
await connection.OpenAsync();
API
| Member | Purpose |
|---|---|
MsSqlBuilder() / MsSqlBuilder(string image) |
Default image mcr.microsoft.com/mssql/server:2022-latest, or a custom image. |
MsSqlBuilder.MsSqlPort (1433) |
Container port, mapped to a random host port. |
WithPassword(string) |
Sets MSSQL_SA_PASSWORD (default YourStrong!Passw0rd); stored as a redacted Secret. |
WithDatabase(string) |
Sets the initial catalog the connection string points at (default master, matching Testcontainers). The database must already exist. |
AcceptLicense() |
Sets ACCEPT_EULA=Y. Required — the library never accepts licensing terms on your behalf. |
MsSqlContainer.GetConnectionString() |
SqlConnectionStringBuilder connection string for the mapped host port (Database=master by default, TrustServerCertificate=True). |
Behaviour and constraints
- Memory: SQL Server refuses to start below 2000 MB. The default session VM is capped at 4096 MB
(
WslContainerRuntimeOptions.Default), so it works out of the box; override withMemorySizeInMBif you configure your own runtime. - Licence:
Build()throwsContainerConfigurationExceptionunlessAcceptLicense()was called. The SA password must be at least 8 characters. - Readiness: a listening TCP port is not enough — the image reports readiness before it can serve
queries, so the default strategy opens a host-side
SqlClientconnection every 2 seconds. The connection string targets127.0.0.1, because WSLC maps IPv4 loopback only andMicrosoft.Data.SqlClienthangs on the IPv6::1address thatlocalhostcan resolve to.
Documentation
- Backends: WSLC or Docker — choosing and configuring the runtime.
- Modules — the module contract and readiness choices.
- Getting Started — prerequisites and first-container walkthrough.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. 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.
-
net10.0
- Microsoft.Data.SqlClient (>= 7.1.1)
- Microsoft.Extensions.Telemetry.Abstractions (>= 10.10.0)
- Purview.Containers.Core (>= 1.0.0-prerelease.5)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 1.0.0-prerelease.5 | 35 | 10/2/2026 |
| 1.0.0-prerelease.4 | 39 | 10/2/2026 |
| 1.0.0-prerelease.3 | 39 | 10/2/2026 |
| 1.0.0-prerelease.2 | 34 | 10/1/2026 |