Skip to content

Commit 54d6245

Browse files
committed
User Story 37654: Create Extensions base package
- Updated BUILDGUIDE with instructions for the Extensions package. - Cleaned up stale BUIDGUIDE sections.
1 parent 6ca814b commit 54d6245

File tree

3 files changed

+50
-45
lines changed

3 files changed

+50
-45
lines changed

BUILDGUIDE.md

Lines changed: 43 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -16,40 +16,47 @@ Once the environment is setup properly, execute the desired set of commands belo
1616

1717
### Targets
1818

19+
The following build targets are defined in `build.proj`:
20+
1921
|Target|Description|
2022
|-|-|
2123
|`BuildAllConfigurations`|Default target. Builds the .NET Framework and .NET drivers for all target frameworks and operating systems.|
24+
|`BuildExtensionsPackage`|Restore, build, and pack the Extensions package, publishing the resulting NuGet into `packages/`.|
2225
|`BuildNetCore`|Builds the .NET driver for all target frameworks.|
2326
|`BuildNetCoreAllOS`|Builds the .NET driver for all target frameworks and operating systems.|
2427
|`BuildNetFx`|Builds the .NET Framework driver for all target frameworks.|
2528
|`BuildTestsNetCore`|Builds tests for the .NET driver.|
2629
|`BuildTestsNetFx`|Builds tests for the .NET Framework driver.|
27-
|`Clean`|Cleans generated files.|
28-
|`Restore`|Restores Nuget packages.|
30+
|`Clean`|Cleans generated files, except for NuGet packages published to `packages/`.|
31+
|`CleanAll`|Cleans all generated files.|
32+
|`Restore`|Restores NuGet packages.|
2933
|`RunTests`|Runs the unit, functional, and manual tests for the .NET Framework and .NET drivers|
3034
|`RunUnitTests`|Runs just the unit tests for the .NET Framework and .NET drivers|
3135
|`RunFunctionalTests`|Runs just the functional tests for the .NET Framework and .NET drivers|
3236
|`RunManualTests`|Runs just the manual tests for the .NET Framework and .NET drivers|
3337
|`BuildAkv`|Builds the Azure Key Vault Provider package for all supported platforms.|
3438

35-
3639
### Parameters
40+
41+
The following parameters may be defined as MSBuild properties to configure the
42+
build:
43+
3744
|Name|Supported Values|Default|Description|
3845
|-|-|-|-|
3946
|`Configuration`|`Debug`, `Release`|`Debug`|Sets the release configuration.|
40-
|`BuildNetFx`|`true`, `false`|`true` (Windows), `false` (other)|If false, skips building the .NET Framework driver on Windows.|
4147
|`OSGroup`|`Unix`, `Windows_NT`, `AnyOS`|typically defaults to the client system's OS, unless using `BuildAllConfigurations` or an `AnyOS` specific target|The operating system to target.|
4248
|`Platform`|`AnyCPU`, `x86`, `x64`, `ARM`, `ARM64`|`AnyCPU`|May only be set when using package reference type or running tests.|
4349
|`TestSet`|`1`, `2`, `3`, `AE`|all|Build or run a subset of the manual tests. Omit (default) to target all tests.|
4450
|`DotnetPath`|Absolute file path to an installed `dotnet` version.|The system default specified by the path variable|Set to run tests using a specific dotnet version (e.g. C:\net6-win-x86\)|
4551
|`TF`|`net8.0`, `net462`, `net47`, `net471`, `net472`, `net48`, `net481`|`net8.0` in netcore, `net462` in netfx|Sets the target framework when building or running tests. Not applicable when building the drivers.|
4652
|`ResultsDirectory`|An absolute file path|./TestResults relative to current directory|Specifies where to write test results.|
4753

48-
4954
## Example Workflows using MSBuild (Recommended)
55+
5056
Using the default configuration and running all tests:
5157

5258
```bash
59+
msbuild -t:BuildExtensionsPackage
5360
msbuild
5461
msbuild -t:BuildTestsNetFx -p:TF=net462
5562
msbuild -t:BuildTestsNetCore
@@ -59,28 +66,31 @@ msbuild -t:RunTests
5966
Using the Release configuration:
6067

6168
```bash
62-
msbuild -p:configuration=Release
63-
msbuild -t:BuildTestsNetFx -p:TF=net462 -p:configuration=Release
64-
msbuild -t:BuildTestsNetCore -p:configuration=Release
65-
msbuild -t:RunTests -p:configuration=Release
69+
msbuild -t:BuildExtensionsPackage -p:Configuration=Release
70+
msbuild -p:Configuration=Release
71+
msbuild -t:BuildTestsNetFx -p:TF=net462 -p:Configuration=Release
72+
msbuild -t:BuildTestsNetCore -p:Configuration=Release
73+
msbuild -t:RunTests -p:Configuration=Release
6674
```
6775

6876
Running only the unit tests:
6977

7078
```bash
79+
msbuild -t:BuildExtensionsPackage
7180
msbuild
7281
msbuild -t:BuildTestsNetFx -p:TF=net462
7382
msbuild -t:BuildTestsNetCore
7483
msbuild -t:RunUnitTests
7584
```
7685

77-
Using a specific dotnet version/architecture:
86+
Using a specific .NET runtime to run tests:
7887

7988
```bash
80-
msbuild -p:configuration=Release
81-
msbuild -t:BuildTestsNetFx -p:TF=net462 -p:configuration=Release
82-
msbuild -t:BuildTestsNetCore -p:configuration=Release
83-
msbuild -t:RunTests -p:configuration=Release -p:DotnetPath=C:\net8-win-x86\
89+
msbuild -t:BuildExtensionsPackage
90+
msbuild
91+
msbuild -t:BuildTestsNetFx -p:TF=net462
92+
msbuild -t:BuildTestsNetCore
93+
msbuild -t:RunTests -p:DotnetPath=C:\net8-win-x86\
8494
```
8595

8696
### Running Manual Tests
@@ -119,15 +129,13 @@ Manual Tests require the below setup to run:
119129
|IsManagedInstance | (Optional) When set to `true` **TVP** related tests will use on non-Azure bs files to compare test results. this is needed when testing against Managed Instances or TVP Tests will fail on Test set 3. The default value is `false`. |
120130
|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` |
121131

122-
123132
## Example workflows using the Dotnet SDK
124133

125-
#### Run Functional Tests
134+
### Run Functional Tests
126135

127136
- Windows (`netfx x86`):
128137

129138
```bash
130-
msbuild
131139
dotnet test "src\Microsoft.Data.SqlClient\tests\FunctionalTests\Microsoft.Data.SqlClient.Tests.csproj" -p:Platform="x86" -p:Configuration="Release" -p:TestTargetOS="Windowsnetfx" --no-build -v n --filter "category!=nonnetfxtests&category!=failing&category!=nonwindowstests"
132140
```
133141

@@ -152,7 +160,8 @@ dotnet test "src\Microsoft.Data.SqlClient\tests\FunctionalTests\Microsoft.Data.S
152160
```bash
153161
dotnet test "src/Microsoft.Data.SqlClient/tests/FunctionalTests/Microsoft.Data.SqlClient.Tests.csproj" -p:Platform="AnyCPU" -p:Configuration="Release" -p:TestTargetOS="Unixnetcoreapp" --no-build -v n --filter "category!=nonnetcoreapptests&category!=failing&category!=nonlinuxtests&category!=nonuaptests"
154162
```
155-
#### Run Manual Tests
163+
164+
### Run Manual Tests
156165

157166
- Windows (`netfx x86`):
158167

@@ -194,35 +203,40 @@ dotnet test "src\Microsoft.Data.SqlClient\tests\ManualTests\Microsoft.Data.SqlCl
194203

195204
Tests can be built and run with custom "Reference Type" property that enables different styles of testing:
196205

197-
- "Project" => Build and run tests with Microsoft.Data.SqlClient as Project Reference
198-
- "Package" => Build and run tests with Microsoft.Data.SqlClient as Package Reference with configured "TestMicrosoftDataSqlClientVersion" in "Versions.props" file.
206+
- "Project" => Build and run tests with Microsoft.Data.SqlClient as a Project Reference
207+
- "Package" => Build and run tests with Microsoft.Data.SqlClient as a Package Reference with configured "TestMicrosoftDataSqlClientVersion" in "Versions.props" file.
199208

200209
> ************** IMPORTANT NOTE BEFORE PROCEEDING WITH "PACKAGE" REFERENCE TYPE ***************
201210
> CREATE A NUGET PACKAGE WITH BELOW COMMAND AND ADD TO LOCAL FOLDER + UPDATE NUGET CONFIG FILE TO READ FROM THAT LOCATION
202211
>
203212
> ```bash
204-
> msbuild -p:configuration=Release
213+
> msbuild -t:BuildExtensionsPackage -p:Configuration=Release
214+
> msbuild -p:Configuration=Release
205215
> ```
206216
207217
A non-AnyCPU platform reference can only be used with package reference type. Otherwise, the specified platform will be replaced with AnyCPU in the build process.
208218
209219
### Building Tests with Reference Type
210220
211-
For .NET, all 4 reference types are supported:
221+
For .NET:
212222
213223
```bash
224+
# Project is the default reference type. The below commands are equivalent:
225+
msbuild -t:BuildTestsNetCore
214226
msbuild -t:BuildTestsNetCore -p:ReferenceType=Project
215-
# Default setting uses Project Reference.
216227
228+
# Package reference type:
217229
msbuild -t:BuildTestsNetCore -p:ReferenceType=Package
218230
```
219231
220-
For .NET Framework, below reference types are supported:
232+
For .NET Framework:
221233

222234
```bash
235+
# Project is the default reference type. The below commands are equivalent:
236+
msbuild -t:BuildTestsNetFx -p:TF=net462
223237
msbuild -t:BuildTestsNetFx -p:TF=net462 -p:ReferenceType=Project
224-
# Default setting uses Project Reference.
225238

239+
# Package reference type:
226240
msbuild -t:BuildTestsNetFx -p:TF=net462 -p:ReferenceType=Package
227241
```
228242

@@ -241,26 +255,25 @@ Tests can be built and run with custom Target Frameworks. See the below examples
241255
### Building Tests with custom target framework
242256

243257
```bash
244-
msbuild -t:BuildTestsNetFx -p:TF=net462
245258
# Build the tests for custom .NET Framework target
259+
msbuild -t:BuildTestsNetFx -p:TF=net462
246260
```
247261

248262
```bash
249-
msbuild -t:BuildTestsNetCore -p:TF=net8.0
250263
# Build the tests for custom .NET target
264+
msbuild -t:BuildTestsNetCore -p:TF=net8.0
251265
```
252266

253267
### Running Tests with custom target framework (traditional)
254268

255269
```bash
270+
# Run tests with custom .NET Framework target
256271
dotnet test -p:TargetNetFxVersion=net462 ...
257-
# Use above property to run Functional Tests with custom .NET Framework target
258272

273+
# Run tests with custom .NET target
259274
dotnet test -p:TargetNetCoreVersion=net8.0 ...
260-
# Use above property to run Functional Tests with custom .NET target
261275
```
262276

263-
264277
## Using Managed SNI on Windows
265278

266279
Managed SNI can be enabled on Windows by enabling the below AppContext switch:
@@ -285,20 +298,6 @@ When connecting to a server, if a protocol lower than TLS 1.2 is negotiated, a s
285298

286299
`Switch.Microsoft.Data.SqlClient.SuppressInsecureTLSWarning`
287300

288-
### Troubleshooting Docker issues
289-
290-
There may be times where connection cannot be made to SQL Server, we found below ideas helpful:
291-
292-
- Clear Docker images to create clean image from time-to-time, and clear docker cache if needed by running `docker system prune` in Command Prompt.
293-
294-
- If you face `Microsoft.Data.SqlClient.SNI.dll not found` errors when debugging, try updating the below properties in the netcore\Microsoft.Data.SqlClient.csproj file and try again:
295-
296-
```xml
297-
<OSGroup>Unix</OSGroup>
298-
<TargetsWindows>false</TargetsWindows>
299-
<TargetsUnix>true</TargetsUnix>
300-
```
301-
302301
## Collecting Code Coverage
303302

304303
### Using VSTest

build.proj

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,12 @@
9595
<!--
9696
The Extensions package must be built and packed into the packages/
9797
directory before the MDS projects can be restored.
98+
99+
We cannot make the driver targets depend on this one because of the way
100+
MSBuild restores projects in "solution mode". It will attempt to restore
101+
all targets in the graph before building any of them, which fails because
102+
MDS depends on the Extensions package being built and packed into packages/
103+
first.
98104
-->
99105
<Target Name="BuildExtensionsPackage">
100106
<PropertyGroup>

eng/pipelines/stages/ci-build-extensions-package-stage.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ stages:
155155
- task: UseDotNet@2
156156
displayName: Install .NET 8.0 Runtime
157157
inputs:
158-
packageType: sdk
158+
packageType: runtime
159159
version: 8.x
160160

161161
# We use the 'custom' command because the DotNetCoreCLI@2 task doesn't

0 commit comments

Comments
 (0)