Skip to content

Commit 383a354

Browse files
committed
Split the C# code/project changes out from the pipeline changes.
- Removed MDS package ref dependency on Abstractions until pipelines are ready. - Renamed AbstractionsPackage to Abstractions in targets. - Updated BUILDGUIDE based on project ref behaviour. - Fixing Abstractions package version specification throughout the different builds. - Minimal YAML pipeline changes to accomodate Abstractions package versioning. - Removed ReferenceType as a variable in all .nuspec files. - Updated Nuget package generation targets to provide appropriate dependent package versions.
1 parent 37d8a3f commit 383a354

31 files changed

+964
-171
lines changed

.editorconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ dotnet_diagnostic.xUnit1031.severity=none
159159
dotnet_diagnostic.xUnit1030.severity=none
160160

161161
# Xml files
162-
[*.{xml,csproj,stylecop,resx,ruleset,props,targets,config,nuspec}]
162+
[*.{xml,slnx,proj,csproj,stylecop,resx,ruleset,props,targets,config,nuspec}]
163163
indent_size = 2
164164

165165
# Shell scripts

BUILDGUIDE.md

Lines changed: 35 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -16,41 +16,45 @@ 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+
|`BuildAbstractions`|Restore, build, and pack the Abstractions 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 all generated files.|
31+
|`Restore`|Restores NuGet packages.|
2932
|`RunTests`|Runs the unit, functional, and manual tests for the .NET Framework and .NET drivers|
3033
|`RunUnitTests`|Runs just the unit tests for the .NET Framework and .NET drivers|
3134
|`RunFunctionalTests`|Runs just the functional tests for the .NET Framework and .NET drivers|
3235
|`RunManualTests`|Runs just the manual tests for the .NET Framework and .NET drivers|
3336
|`BuildAkv`|Builds the Azure Key Vault Provider package for all supported platforms.|
3437

35-
3638
### Parameters
39+
40+
The following parameters may be defined as MSBuild properties to configure the
41+
build:
42+
3743
|Name|Supported Values|Default|Description|
3844
|-|-|-|-|
3945
|`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.|
4146
|`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.|
4247
|`Platform`|`AnyCPU`, `x86`, `x64`, `ARM`, `ARM64`|`AnyCPU`|May only be set when using package reference type or running tests.|
4348
|`TestSet`|`1`, `2`, `3`, `AE`|all|Build or run a subset of the manual tests. Omit (default) to target all tests.|
4449
|`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\)|
4550
|`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.|
4651
|`ResultsDirectory`|An absolute file path|./TestResults relative to current directory|Specifies where to write test results.|
4752

48-
4953
## Example Workflows using MSBuild (Recommended)
54+
5055
Using the default configuration and running all tests:
5156

5257
```bash
53-
msbuild
5458
msbuild -t:BuildTestsNetFx -p:TF=net462
5559
msbuild -t:BuildTestsNetCore
5660
msbuild -t:RunTests
@@ -59,28 +63,25 @@ msbuild -t:RunTests
5963
Using the Release configuration:
6064

6165
```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
66+
msbuild -t:BuildTestsNetFx -p:TF=net462 -p:Configuration=Release
67+
msbuild -t:BuildTestsNetCore -p:Configuration=Release
68+
msbuild -t:RunTests -p:Configuration=Release
6669
```
6770

6871
Running only the unit tests:
6972

7073
```bash
71-
msbuild
7274
msbuild -t:BuildTestsNetFx -p:TF=net462
7375
msbuild -t:BuildTestsNetCore
7476
msbuild -t:RunUnitTests
7577
```
7678

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

7981
```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\
82+
msbuild -t:BuildTestsNetFx -p:TF=net462
83+
msbuild -t:BuildTestsNetCore
84+
msbuild -t:RunTests -p:DotnetPath=C:\net8-win-x86\
8485
```
8586

8687
### Running Manual Tests
@@ -119,15 +120,13 @@ Manual Tests require the below setup to run:
119120
|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`. |
120121
|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` |
121122

122-
123123
## Example workflows using the Dotnet SDK
124124

125-
#### Run Functional Tests
125+
### Run Functional Tests
126126

127127
- Windows (`netfx x86`):
128128

129129
```bash
130-
msbuild
131130
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"
132131
```
133132

@@ -152,7 +151,8 @@ dotnet test "src\Microsoft.Data.SqlClient\tests\FunctionalTests\Microsoft.Data.S
152151
```bash
153152
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"
154153
```
155-
#### Run Manual Tests
154+
155+
### Run Manual Tests
156156

157157
- Windows (`netfx x86`):
158158

@@ -194,35 +194,39 @@ dotnet test "src\Microsoft.Data.SqlClient\tests\ManualTests\Microsoft.Data.SqlCl
194194

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

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.
197+
- "Project" => Build and run tests with Microsoft.Data.SqlClient as a Project Reference
198+
- "Package" => Build and run tests with Microsoft.Data.SqlClient as a Package Reference with configured "TestMicrosoftDataSqlClientVersion" in "Versions.props" file.
199199

200200
> ************** IMPORTANT NOTE BEFORE PROCEEDING WITH "PACKAGE" REFERENCE TYPE ***************
201201
> CREATE A NUGET PACKAGE WITH BELOW COMMAND AND ADD TO LOCAL FOLDER + UPDATE NUGET CONFIG FILE TO READ FROM THAT LOCATION
202202
>
203203
> ```bash
204-
> msbuild -p:configuration=Release
204+
> msbuild -p:Configuration=Release
205205
> ```
206206
207207
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.
208208
209209
### Building Tests with Reference Type
210210
211-
For .NET, all 4 reference types are supported:
211+
For .NET:
212212
213213
```bash
214+
# Project is the default reference type. The below commands are equivalent:
215+
msbuild -t:BuildTestsNetCore
214216
msbuild -t:BuildTestsNetCore -p:ReferenceType=Project
215-
# Default setting uses Project Reference.
216217
218+
# Package reference type:
217219
msbuild -t:BuildTestsNetCore -p:ReferenceType=Package
218220
```
219221
220-
For .NET Framework, below reference types are supported:
222+
For .NET Framework:
221223

222224
```bash
225+
# Project is the default reference type. The below commands are equivalent:
226+
msbuild -t:BuildTestsNetFx -p:TF=net462
223227
msbuild -t:BuildTestsNetFx -p:TF=net462 -p:ReferenceType=Project
224-
# Default setting uses Project Reference.
225228

229+
# Package reference type:
226230
msbuild -t:BuildTestsNetFx -p:TF=net462 -p:ReferenceType=Package
227231
```
228232

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

243247
```bash
244-
msbuild -t:BuildTestsNetFx -p:TF=net462
245248
# Build the tests for custom .NET Framework target
249+
msbuild -t:BuildTestsNetFx -p:TF=net462
246250
```
247251

248252
```bash
249-
msbuild -t:BuildTestsNetCore -p:TF=net8.0
250253
# Build the tests for custom .NET target
254+
msbuild -t:BuildTestsNetCore -p:TF=net8.0
251255
```
252256

253257
### Running Tests with custom target framework (traditional)
254258

255259
```bash
260+
# Run tests with custom .NET Framework target
256261
dotnet test -p:TargetNetFxVersion=net462 ...
257-
# Use above property to run Functional Tests with custom .NET Framework target
258262

263+
# Run tests with custom .NET target
259264
dotnet test -p:TargetNetCoreVersion=net8.0 ...
260-
# Use above property to run Functional Tests with custom .NET target
261265
```
262266

263-
264267
## Using Managed SNI on Windows
265268

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

286289
`Switch.Microsoft.Data.SqlClient.SuppressInsecureTLSWarning`
287290

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-
302291
## Collecting Code Coverage
303292

304293
### Using VSTest

NuGet.config

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,30 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<configuration>
33
<packageSources>
4+
5+
<!-- Clear all inherited feeds. -->
46
<clear />
5-
<add key="sqlclient" value="https://sqlclientdrivers.pkgs.visualstudio.com/public/_packaging/sqlclient/nuget/v3/index.json" />
7+
8+
<!--
9+
We do not use the public nuget.org feed. Instead, we use a governed
10+
feed maintained by our SqlClientDrivers ADO organization. Packages must
11+
be individually vetted and added to this feed manually before they will
12+
be available for consumption by our builds.
13+
14+
https://sqlclientdrivers.visualstudio.com/public/_artifacts/feed/sqlclient
15+
-->
16+
<add key="governed" value="https://sqlclientdrivers.pkgs.visualstudio.com/public/_packaging/sqlclient/nuget/v3/index.json" />
617
</packageSources>
18+
719
<auditSources>
20+
21+
<!-- Clear all inherited audit sources. -->
822
<clear />
23+
24+
<!--
25+
There is no governed ADO feed for auditing, so we use the public
26+
nuget.org source.
27+
-->
928
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" />
1029
</auditSources>
1130
</configuration>

0 commit comments

Comments
 (0)