microsoft/sqlclient-migration
> Migrates .NET projects from System.Data.SqlClient to Microsoft.Data.SqlClient. Use when user wants to upgrade SqlClient, migrate to Microsoft.Data.SqlClient, or modernize SQL Server data access.
npx skills add https://github.com/microsoft/upgrade-agent-plugins --skill sqlclient-migration
Scan the solution to build a complete picture of SqlClient usage. Capture findings in assessment.md.
Search all project files and package management files (Directory.Packages.props) for:
System.Data.SqlClient (direct package reference)System.Data (older projects may use the framework assembly rather than a NuGet package)Search all code files across the solution for using System.Data.SqlClient. Record which files in which projects contain these usings — this gives a quick per-project file count that drives planning.
The patterns below help gauge complexity per project. You don't need to search for each one separately — note them as you encounter them during the usings scan or during execution:
| Pattern | What to Record |
|---------|---------------|
| SqlConnection, SqlCommand, SqlDataReader, SqlDataAdapter | Count and locations — core types that change namespace |
| SqlBulkCopy usage | Same namespace change, verify behavior matches |
| SqlParameter with DbType.Time or DbType.Date | DateTime/TimeSpan behavior difference (see risk indicators) |
| SqlFileStream | Moves to a different namespace |
| SqlDataRecord, SqlMetaData | Move to a different namespace |
| SqlNotificationRequest | Moves to a different namespace |
Search app.config, web.config, appsettings.json, and code files for connection strings targeting SQL Server. For each, record:
Encrypt is explicitly set (if not, behavior changes — see risk indicators)TrustServerCertificate is explicitly setTrustServerCertificate=true)Flag these as higher complexity in the assessment:
Encrypt setting — Microsoft.Data.SqlClient defaults to Encrypt=true (was false), which may break connections to servers without valid TLS certificatesDateTime for DbType.Time parameters — Microsoft.Data.SqlClient requires TimeSpan; DbType.Date now truncates time componentsTrustServerCertificate=true addedEncrypt property becomes SqlConnectionEncryptOption enum instead of boolCreate assessment.md in the workflow folder with this structure:
# Assessment: System.Data.SqlClient to Microsoft.Data.SqlClient
## Affected Projects
| Project | Reference Type | Key Patterns | Connection String Risk | Risk |
|---------|---------------|-------------|----------------------|------|
| MyApp.Data | Package ref | SqlConnection, SqlBulkCopy | Encrypt not set | High |
| MyApp.Tests | Transitive | SqlConnection in test helpers | N/A | Low |
## Connection Strings Found
| Location | Encrypt Set? | TrustServerCertificate Set? | Action Needed |
|----------|-------------|---------------------------|---------------|
| appsettings.json | No | No | Review — defaults changed |
## Key Findings
- [Notable patterns, risks, or decisions needed]
Based on the assessment, create plan.md with tasks ordered bottom-up (leaf dependencies first, then consumers).
For each task include:
Include a cross-cutting task for connection string review if any strings lack explicit encryption settings.
Execute the plan task by task. For any task that involves migrating SqlClient code or packages, apply the migrating-to-microsoft-data-sqlclient feature skill. It provides namespace mappings, package changes, encryption guidance, and validation steps.
After completing all tasks, do a final solution-wide search for any remaining System.Data.SqlClient references and fix stragglers.
System.Data.SqlClient namespace references in codeTake microsoft/sqlclient-migration from the repository into ~/.claude/skills for personal
use, or into .claude/skills inside a project.
The agent identifies a skill by the name field in its header. Two skills with the
same name cannot sit side by side — one of them will be ignored.