Skip to content

Commit 98cb968

Browse files
committed
Task 43695: Use dotnet CLI exclusively
- Removed use of MSBuild in pipelines and documentation. - Legacy build.proj still uses it, and will be replaced shortly by build2.proj which uses the dotnet CLI exclusively.
1 parent d197d6a commit 98cb968

16 files changed

Lines changed: 127 additions & 157 deletions

.github/copilot-instructions.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ The project includes:
2121
- **Manual Tests**: Located in `tests/ManualTests/` directory, which includes tests that require a SQL Server instance to run.
2222
- **Documentation**: Found in the `doc/` directory, including API documentation, usage examples.
2323
- **Policies**: Contribution guidelines, coding standards, and review policies in the `policy/` directory.
24-
- **Building**: The project uses MSBuild for building and testing, with configurations and targets defined in the `build.proj` file, whereas instructions are provided in the `BUILDGUIDE.md` file.
24+
- **Building**: The project uses `dotnet build` for building and testing, with configurations and targets defined in the `build.proj` file, whereas instructions are provided in the `BUILDGUIDE.md` file.
2525
- **CI/CD**: ADO Pipelines for CI/CD and Pull request validation are defined in the `eng/` directory, ensuring code quality and automated testing.
2626

2727
## 📦 Products

.github/instructions/ado-pipelines.instructions.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ Key parameters:
4848
- `runAlwaysEncryptedTests` — include AE test set; default `true`
4949
- `enableStressTests` — enable stress test stage; default `false`
5050
- `debug` — enable debug output; default `false`
51-
- `dotnetVerbosity`MSBuild verbosity; default `normal`
51+
- `dotnetVerbosity`build verbosity; default `normal`
5252

5353
## Build Stage Order
5454

.github/instructions/architecture.instructions.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ The `netcore/` and `netfx/` directories are legacy artifacts from the old dual-p
4848
- `netcore/ref/` and `netfx/ref/`**STILL ACTIVE**. Reference assemblies remain in these directories and define the public API surface for each target framework.
4949

5050
### OS Targeting with `TargetOs`
51-
The unified project uses a `TargetOs` MSBuild property to handle OS-specific compilation:
51+
The unified project uses a `TargetOs` build property to handle OS-specific compilation:
5252

5353
```xml
5454
<!-- Automatic OS detection -->

.github/instructions/testing.instructions.md

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ The default test filter is defined in `build.proj`:
113113
```xml
114114
<FilterStatement Condition="'$(FilterStatement)' == ''">category!=failing&amp;category!=flaky</FilterStatement>
115115
```
116-
This can be overridden via MSBuild property: `msbuild -p:FilterStatement="your_filter"`.
116+
This can be overridden via build property: `dotnet build build.proj -p:FilterStatement="your_filter"`.
117117

118118
### Test Attributes
119119
```csharp
@@ -137,19 +137,19 @@ public void TestIntermittentlyFails() { ... }
137137

138138
## Running Tests
139139

140-
### Using MSBuild (Recommended)
140+
### Using `dotnet build` (Recommended)
141141
```bash
142142
# Build and run all unit tests
143-
msbuild -t:RunUnitTests
143+
dotnet build build.proj -t:RunUnitTests
144144

145145
# Run functional tests only
146-
msbuild -t:RunFunctionalTests
146+
dotnet build build.proj -t:RunFunctionalTests
147147

148148
# Run manual tests for specific framework
149-
msbuild -t:RunManualTests -p:TF=net8.0
149+
dotnet build build.proj -t:RunManualTests -p:TF=net8.0
150150

151151
# Run specific test set
152-
msbuild -t:RunManualTests -p:TestSet=1
152+
dotnet build build.proj -t:RunManualTests -p:TestSet=1
153153
```
154154

155155
### Using dotnet CLI
@@ -323,7 +323,7 @@ AssertExtensions.ThrowsContains<SqlException>(() => action(), "expected message"
323323

324324
### Running with Coverage
325325
```bash
326-
msbuild -t:RunTests -p:CollectCoverage=true
326+
dotnet build build.proj -t:RunTests -p:CollectCoverage=true
327327
```
328328

329329
### Coverage Targets
@@ -333,16 +333,11 @@ msbuild -t:RunTests -p:CollectCoverage=true
333333

334334
## Debugging Tests
335335

336-
### Visual Studio
336+
### IDE
337337
1. Set breakpoints in test code
338-
2. Right-click test → Debug Test
338+
2. Right-click test → Debug Test (or use CodeLens "Debug Test" link)
339339
3. Use Test Explorer for navigation
340340

341-
### VS Code
342-
1. Configure C# extension
343-
2. Use CodeLens "Debug Test" link
344-
3. Attach to test process
345-
346341
### Command Line
347342
```bash
348343
# Enable verbose output

.github/plans/apicompat-ref-assembly-validation.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ The comparison uses `Microsoft.DotNet.ApiCompat.Tool` in **strict mode**, which
99
## Usage
1010

1111
```
12-
dotnet msbuild build.proj /t:CompareRefAssemblies /p:BaselinePackageVersion=6.1.4
12+
dotnet build build.proj /t:CompareRefAssemblies /p:BaselinePackageVersion=6.1.4
1313
```
1414

1515
- `BaselinePackageVersion` is **required** (no default). The user must specify which published package to compare against.
@@ -111,7 +111,7 @@ Add one line after the existing `.targets` imports (after line 7):
111111
## Verification
112112

113113
```
114-
dotnet msbuild build.proj /t:CompareRefAssemblies /p:BaselinePackageVersion=6.1.4
114+
dotnet build build.proj /t:CompareRefAssemblies /p:BaselinePackageVersion=6.1.4
115115
```
116116

117117
- Downloads 6.1.4 nupkg, builds both ref project variants, runs 8 comparisons (4 TFMs × 2 variants).

BUILDGUIDE.md

Lines changed: 19 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -6,20 +6,15 @@ This document provides all the necessary details to build the driver and run tes
66

77
### .NET SDK
88

9-
The projects in this repo require the .NET 10.0 SDK to build. Please ensure you
10-
have the latest version of that SDK installed.
9+
The projects in this repo require the .NET 10.0 SDK to build and test. Please ensure you have the
10+
latest version of that SDK installed.
1111

12-
Tests and tools may require different .NET Runtimes that may be installed
13-
independently. For example, tests targeting .NET 8.0 will need that runtime
14-
installed.
12+
Tests and tools may require different .NET Runtimes that may be installed independently. For
13+
example, tests targeting .NET 8.0 will need that runtime installed.
1514

16-
### Visual Studio
15+
### PowerShell
1716

18-
This project should be built with Visual Studio 2019+ for the best compatibility. The required set of components are provided in the below file:
19-
20-
- **Visual Studio 2019** with imported components: [VS19Components](/tools/vsconfig/VS19Components.vsconfig)
21-
22-
- **Powershell**: To build SqlClient on Linux, powershell is needed as well. Follow the distro specific instructions at [Install Powershell on Linux](https://learn.microsoft.com/en-us/powershell/scripting/install/installing-powershell-on-linux?view=powershell-7.4)
17+
To build SqlClient on Linux, PowerShell is needed. Follow the distro specific instructions at [Install PowerShell on Linux](https://learn.microsoft.com/en-us/powershell/scripting/install/installing-powershell-on-linux?view=powershell-7.4)
2318

2419
Once the environment is setup properly, execute the desired set of commands below from the _root_ folder to perform the respective operations:
2520

@@ -57,7 +52,7 @@ Manual Tests require the below setup to run:
5752
|IsManagedInstance | (Optional) When set to `true` **TVP** related tests will use non-Azure bsl files to compare test results. This is needed when testing against Azure Managed Instances; otherwise TVP Tests will fail on TestSet 3. The default value is `false`. |
5853
|PowerShellPath | The full path to PowerShell.exe. This is not required if the path is present in the PATH environment variable. | `D:\\escaped\\absolute\\path\\to\\PowerShell.exe` |
5954

60-
## MSBuild Reference
55+
## Build Reference
6156

6257
### Targets
6358

@@ -87,7 +82,7 @@ The following build targets are defined in `build.proj`:
8782

8883
### Parameters
8984

90-
The following parameters may be defined as MSBuild properties to configure the
85+
The following parameters may be defined as properties to configure the
9186
build:
9287

9388
|Name|Supported Values|Default|Description|
@@ -100,43 +95,43 @@ build:
10095
|`TF`|`net8.0`, `net462`, `net47`, `net471`, `net472`, `net48`, `net481`|`net9.0` in netcore, `net462` in netfx|Sets the target framework when building or running tests. Not applicable when building the drivers.|
10196
|`ResultsDirectory`|An absolute file path|./TestResults relative to current directory|Specifies where to write test results.|
10297

103-
## Example Commands to Run Tests Using MSBuild (Recommended)
98+
## Example Commands to Run Tests Using `dotnet build` (Recommended)
10499

105100
Using the default configuration and running all tests:
106101

107102
```bash
108-
msbuild -t:RunTests
103+
dotnet build build.proj -t:RunTests
109104
```
110105

111106
Using the Release configuration:
112107

113108
```bash
114-
msbuild -t:RunTests -p:Configuration=Release
109+
dotnet build build.proj -t:RunTests -p:Configuration=Release
115110
```
116111

117112
Running only the unit tests:
118113

119114
```bash
120-
msbuild -t:RunUnitTests
115+
dotnet build build.proj -t:RunUnitTests
121116
```
122117

123118
Using a specific .NET runtime to run tests:
124119

125120
```bash
126-
msbuild -t:RunTests -p:DotnetPath=C:\net8-win-x86\
121+
dotnet build build.proj -t:RunTests -p:DotnetPath=C:\net8-win-x86\
127122
```
128123

129124
To run tests against a specific version of .NET/.NET Framework, set the `-p:TF` parameter.
130125

131126
```bash
132-
msbuild -t:RunTests -p:TF=net8.0
133-
msbuild -t:RunTests -p:TF=net462
127+
dotnet build build.proj -t:RunTests -p:TF=net8.0
128+
dotnet build build.proj -t:RunTests -p:TF=net462
134129
```
135130

136-
## Example Commands to Run Tests using `dotnet`
131+
## Example Commands to Run Tests using `dotnet test`
137132

138-
Under the hood, the MSBuild commands to run tests use `dotnet` commands. But, if you wish to run
139-
them without the overhead of wrapping/unwrapping in MSBuild, you can run them directly.
133+
Under the hood, the build targets to run tests use `dotnet test` commands. But, if you wish to run
134+
them without the overhead of the build.proj orchestration, you can run them directly.
140135

141136
To change the processor architecture that runs the test (where possible, ie, x86 on x64), use the
142137
appropriate `dotnet` executable.
@@ -170,6 +165,7 @@ dotnet test "src/Microsoft.Data.SqlClient/tests/ManualTests/Microsoft.Data.SqlCl
170165
```
171166

172167
### Run Unit Tests
168+
173169
```bash
174170
dotnet test "src/Microsoft.Data.SqlClient/tests/UnitTests/Microsoft.Data.SqlClient.UnitTests.csproj" \
175171
-p:Configuration=Release \
@@ -219,7 +215,6 @@ Provide property to `dotnet test` commands for testing desired reference type.
219215
dotnet test -p:ReferenceType=Project ...
220216
```
221217

222-
223218
## Using Managed SNI on Windows
224219

225220
Managed SNI can be enabled on Windows by enabling the below AppContext switch:

doc/apps/AzureAuthentication/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ The app is designed to run against both **published NuGet packages** and **local
2828

2929
## Build Parameters
3030

31-
Package versions are controlled through MSBuild properties. Pass them on the command line with `-p:`
31+
Package versions are controlled through build properties. Pass them on the command line with `-p:`
3232
(or `/p:`) to override the defaults defined in `Directory.Packages.props`.
3333

3434
| Property | Default | Description |

eng/pipelines/common/templates/jobs/ci-build-nugets-job.yml

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,6 @@ jobs:
8585
name: ${{parameters.poolName }}
8686
demands:
8787
- imageOverride -equals ${{ parameters.imageOverride }}
88-
- msbuild
8988

9089
variables:
9190
- template: /eng/pipelines/libraries/ci-build-variables.yml@self
@@ -176,15 +175,15 @@ jobs:
176175
mdsPackageVersion: ${{ parameters.mdsPackageVersion }}
177176
akvPackageVersion: ${{ parameters.akvPackageVersion }}
178177

179-
- task: MSBuild@1
178+
- task: DotNetCoreCLI@2
180179
displayName: 'Create AKV Provider NuGet Package'
181180
inputs:
182-
solution: build.proj
183-
msbuildArchitecture: x64
184-
platform: '${{ parameters.platform }}'
185-
configuration: '${{ parameters.buildConfiguration }}'
186-
msbuildArguments: >-
181+
command: build
182+
projects: build.proj
183+
arguments: >-
187184
-t:PackAkvProvider
185+
-p:Platform=${{ parameters.platform }}
186+
-p:Configuration=${{ parameters.buildConfiguration }}
188187
-p:ReferenceType=${{ parameters.referenceType }}
189188
-p:LoggingPackageVersion=${{ parameters.loggingPackageVersion }}
190189
-p:MdsPackageVersion=${{ parameters.mdsPackageVersion }}

eng/pipelines/common/templates/steps/ci-project-build-step.yml

Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -75,16 +75,15 @@ parameters:
7575
steps:
7676
# Build MDS
7777
- ${{ if or(eq(parameters.build, 'MDS'), eq(parameters.build, 'all'), eq(parameters.build, 'allNoDocs')) }}:
78-
- task: MSBuild@1
78+
- task: DotNetCoreCLI@2
7979
displayName: 'Build Driver'
8080
condition: and(succeeded(), eq(variables['Agent.OS'], 'Windows_NT'))
8181
inputs:
82-
solution: build2.proj
83-
msbuildArchitecture: x64
84-
platform: '${{ parameters.platform }}'
85-
configuration: '${{ parameters.buildConfiguration }}'
86-
msbuildArguments:
82+
command: build
83+
projects: build2.proj
84+
arguments: >-
8785
-t:BuildMds
86+
-p:Configuration=${{ parameters.buildConfiguration }}
8887
-p:ReferenceType=${{ parameters.referenceType }}
8988
-p:BuildNumber=${{ parameters.assemblyBuildNumber }}
9089
-p:PackageVersionAbstractions=${{ parameters.abstractionsPackageVersion }}
@@ -93,16 +92,15 @@ steps:
9392
9493
# Build AKV Provider
9594
- ${{ if or(eq(parameters.build, 'AkvProvider'), eq(parameters.build, 'all'), eq(parameters.build, 'allNoDocs')) }}:
96-
- task: MSBuild@1
95+
- task: DotNetCoreCLI@2
9796
displayName: 'Build AKV Provider'
9897
condition: and(succeeded(), eq(variables['Agent.OS'], 'Windows_NT'))
9998
inputs:
100-
solution: build.proj
101-
msbuildArchitecture: x64
102-
platform: '${{ parameters.platform }}'
103-
configuration: '${{ parameters.buildConfiguration }}'
104-
msbuildArguments: >-
99+
command: build
100+
projects: build.proj
101+
arguments: >-
105102
-t:BuildAkvProvider
103+
-p:Platform=${{ parameters.platform }}
106104
-p:ReferenceType=${{ parameters.referenceType }}
107105
-p:TestEnabled=true
108106
-p:GenerateNuget=false
@@ -113,6 +111,3 @@ steps:
113111
-p:AbstractionsPackageVersion=${{ parameters.abstractionsPackageVersion }}
114112
-p:LoggingPackageVersion=${{ parameters.loggingPackageVersion }}
115113
-p:MdsPackageVersion=${{ parameters.mdsPackageVersion }}
116-
verbosityRestore: Detailed
117-
verbosityPack: Detailed
118-

0 commit comments

Comments
 (0)