Skip to content
6 changes: 3 additions & 3 deletions .github/copilot-instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@

## 📚 Project Overview
This project is a .NET data provider for SQL Server, enabling .NET applications to interact with SQL Server databases. It supports various features like connection pooling, transaction management, and asynchronous operations.
The project builds from a **single unified project** at `src/Microsoft.Data.SqlClient/src/Microsoft.Data.SqlClient.csproj`. It targets `net8.0` and `net9.0` on all supported hosts, and adds `net462` only when building on Windows. The legacy `netfx/` and `netcore/` directories are being phased out — only their `ref/` folders (which define the public API surface) remain active.
The project builds from a **single unified project** at `src/Microsoft.Data.SqlClient/src/Microsoft.Data.SqlClient.csproj`. Its framework and platform selection is defined by the project and imported build files. Public API declarations are unified under `src/Microsoft.Data.SqlClient/ref/`; the legacy `netfx/` and `netcore/` directories are no longer used.
The project includes:
- **Public APIs**: Defined in `netcore/ref/` and `netfx/ref/` directories.
- **Public APIs**: Defined by `src/Microsoft.Data.SqlClient/ref/Microsoft.Data.SqlClient.csproj` and the reference source files beside it.
- **Implementations**: All source code in `src/Microsoft.Data.SqlClient/src/`.
- **Tests**: Located in the `tests/` directory, covering unit and integration tests.
- **Unit Tests**: Located in `src/Microsoft.Data.SqlClient/tests/UnitTests/`.
Expand Down Expand Up @@ -137,7 +137,7 @@ When a new issue is created, follow these steps:

## 🧠 Contextual Awareness
- All source code is in `src/Microsoft.Data.SqlClient/src/`. Do NOT add code to legacy `netfx/src/` or `netcore/src/` directories.
- Only `ref/` folders in `netcore/ref/` and `netfx/ref/` remain active for defining the public API surface.
- Public API changes must update the unified `src/Microsoft.Data.SqlClient/ref/` sources for each affected target framework.
- Check for platform-specific differences using file suffixes (`.netfx.cs`, `.netcore.cs`, `.windows.cs`, `.unix.cs`) and conditional compilation (`#if NETFRAMEWORK`, `#if NET`, `#if _WINDOWS`, `#if _UNIX`).
- Respect API compatibility rules across .NET versions
- Do not introduce breaking changes without proper justification and documentation
Expand Down
12 changes: 6 additions & 6 deletions .github/instructions/api-design.instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ Microsoft.Data.SqlClient follows strict API design guidelines to ensure:
### Structure
```
src/Microsoft.Data.SqlClient/
├── netcore/ref/ # .NET Core/.NET public APIs
│ └── Microsoft.Data.SqlClient.cs
└── netfx/ref/ # .NET Framework public APIs
└── Microsoft.Data.SqlClient.cs
└── ref/ # Unified public API declarations
├── Microsoft.Data.SqlClient.csproj
├── Microsoft.Data.SqlClient.cs
└── Microsoft.Data.SqlTypes.cs # Other namespace-specific files alongside
```

### API Surface
Expand All @@ -32,8 +32,8 @@ The reference assemblies do **not** use C# nullable context (`#nullable enable`)

### Updating Public APIs
When adding or modifying public APIs:
1. Update reference assembly in BOTH `netcore/ref/` and `netfx/ref/`
2. Ensure signatures match across platforms
1. Update the corresponding sources under `src/Microsoft.Data.SqlClient/ref/`
2. Ensure signatures match the implementation for each affected framework, including conditional declarations
3. Add XML documentation
4. Consider backward compatibility
5. Do not use nullable annotations (`?`) in ref assemblies (see above)
Expand Down
29 changes: 10 additions & 19 deletions .github/instructions/architecture.instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,8 @@ This repository contains the official Microsoft ADO.NET data provider for SQL Se
src/
├── Microsoft.Data.SqlClient/
│ ├── add-ons/ # Azure Key Vault provider
│ ├── netcore/ # ⚠️ LEGACY - being phased out
│ │ └── ref/ # Reference assemblies for .NET Core/.NET
│ ├── netfx/ # ⚠️ LEGACY - being phased out
│ │ └── ref/ # Reference assemblies for .NET Framework
│ ├── ref/ # Shared reference assembly files
│ ├── ref/ # Unified public API declarations
│ │ └── Microsoft.Data.SqlClient.csproj # Multi-target reference project
│ ├── src/ # ✅ PRIMARY - Unified source for all platforms
│ │ ├── Microsoft.Data.SqlClient.csproj # Multi-target project file
│ │ ├── Interop/ # P/Invoke and native interop
Expand All @@ -34,19 +31,13 @@ src/
## Unified Project Model

### Architecture Goal
The driver is transitioning away from separate `netfx/` and `netcore/` project files toward a **single unified project** at `src/Microsoft.Data.SqlClient/src/Microsoft.Data.SqlClient.csproj`. This project targets the modern .NET TFMs on every host and conditionally adds .NET Framework on Windows:

```xml
<TargetFrameworks>net8.0;net9.0</TargetFrameworks>
<TargetFrameworks Condition="'$(NormalizedTargetOs)' == 'windows_nt'">$(TargetFrameworks);net462</TargetFrameworks>
```
The driver implementation is built from `src/Microsoft.Data.SqlClient/src/Microsoft.Data.SqlClient.csproj`; its public API declarations are built from `src/Microsoft.Data.SqlClient/ref/Microsoft.Data.SqlClient.csproj`. Check those projects and their imported build files for framework and platform selection.

**All new code MUST go into `src/Microsoft.Data.SqlClient/src/`**. Do NOT add files to the legacy `netcore/src/` or `netfx/src/` directories.

### Legacy Folders
The `netcore/` and `netfx/` directories are legacy artifacts from the old dual-project model:
- `netcore/src/` and `netfx/src/` — **DEPRECATED**. These contain legacy project files that are being phased out. Do not add new code here.
- `netcore/ref/` and `netfx/ref/` — **STILL ACTIVE**. Reference assemblies remain in these directories and define the public API surface for each target framework.
The former `netcore/` and `netfx/` source and reference directories are no longer
used. Do not recreate them; use the unified `src/` and `ref/` directories.

### OS Targeting with `TargetOs`
The unified project uses a `TargetOs` build property to handle OS-specific compilation:
Expand Down Expand Up @@ -97,12 +88,12 @@ The unified project uses conditional `ItemGroup` elements for dependencies:
- **Shared**: `Azure.Core`, `Azure.Identity`, `Microsoft.Bcl.Cryptography`, `Microsoft.Extensions.Caching.Memory`, `Microsoft.IdentityModel.*`, `System.Security.Cryptography.Pkcs`

### Reference Assemblies
The `ref/` directories define the public API surface:
- `netcore/ref/` — Public APIs for .NET Core/.NET (includes `Microsoft.Data.SqlClient.cs`, `Microsoft.Data.SqlClient.Manual.cs`)
- `netfx/ref/` — Public APIs for .NET Framework (includes `Microsoft.Data.SqlClient.cs`)
- `ref/` — Shared reference assembly files (e.g., `Microsoft.Data.SqlClient.Batch.cs`, `Microsoft.Data.SqlClient.Batch.NetCoreApp.cs`)
`src/Microsoft.Data.SqlClient/ref/Microsoft.Data.SqlClient.csproj` builds the unified
reference sources for `net462`, `net8.0`, `net9.0`, and `netstandard2.0`. Declarations
are grouped by namespace, with conditional compilation for framework differences.

**IMPORTANT**: Any public API changes MUST update the corresponding reference assembly in the appropriate `ref/` directory.
**IMPORTANT**: Public API changes MUST update the corresponding files under
`src/Microsoft.Data.SqlClient/ref/` for every affected target framework.

### Build Output
Build artifacts are organized by reference mode, configuration, OS, and framework:
Expand Down
99 changes: 0 additions & 99 deletions .github/prompts/code-review.prompt.md

This file was deleted.

2 changes: 1 addition & 1 deletion .github/prompts/fix-bug.prompt.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ Follow this workflow step-by-step:
- Ensure the fix compiles for ALL target frameworks: `net462`, `net8.0`, `net9.0`.
- If the fix requires platform-specific code, use the appropriate conditional compilation directives.
- Do NOT introduce breaking changes to public APIs.
- If a public API must change, update the reference assemblies in `netcore/ref/` and `netfx/ref/`.
- If a public API must change, update the corresponding sources under `src/Microsoft.Data.SqlClient/ref/`, including conditional declarations for each affected framework.

## 5. Validate
- Verify the failing test now passes with the fix applied.
Expand Down
6 changes: 2 additions & 4 deletions .github/prompts/implement-feature.prompt.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,8 @@ Before writing code, produce a brief implementation plan covering:
- **Documentation plan** — XML docs, samples, release notes entries.

## 3. Update Reference Assemblies (if public API changes)
- If adding new public APIs, update reference assemblies FIRST:
- `netcore/ref/Microsoft.Data.SqlClient.cs` and/or `Microsoft.Data.SqlClient.Manual.cs` for .NET Core/.NET APIs
- `netfx/ref/Microsoft.Data.SqlClient.cs` for .NET Framework APIs
- `ref/` shared files if the API applies to batch or cross-framework features
- If adding or changing public APIs, update the corresponding namespace-specific sources under `src/Microsoft.Data.SqlClient/ref/` FIRST.
- Ensure signatures match the implementation for each affected framework, including conditional declarations.
- Include only the method/property signatures with no implementation.
- Add XML documentation comments on all public members.

Expand Down
Loading
Loading