You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: BUILDGUIDE.md
+76-58Lines changed: 76 additions & 58 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -25,6 +25,8 @@ Once the environment is setup properly, execute the desired set of commands belo
25
25
26
26
### Targets
27
27
28
+
The following build targets are defined in `build.proj`:
29
+
28
30
|Target|Description|
29
31
|-|-|
30
32
|`BuildAllConfigurations`|Default target. Builds the .NET Framework and .NET drivers for all target frameworks and operating systems.|
@@ -33,33 +35,34 @@ Once the environment is setup properly, execute the desired set of commands belo
33
35
|`BuildNetFx`|Builds the .NET Framework driver for all target frameworks.|
34
36
|`BuildTestsNetCore`|Builds tests for the .NET driver.|
35
37
|`BuildTestsNetFx`|Builds tests for the .NET Framework driver.|
36
-
|`Clean`|Cleans generated files.|
37
-
|`Restore`|Restores Nuget packages.|
38
+
|`Clean`|Cleans all generated files.|
39
+
|`Restore`|Restores NuGet packages.|
38
40
|`RunTests`|Runs the unit, functional, and manual tests for the .NET Framework and .NET drivers|
39
41
|`RunUnitTests`|Runs just the unit tests for the .NET Framework and .NET drivers|
40
42
|`RunFunctionalTests`|Runs just the functional tests for the .NET Framework and .NET drivers|
41
43
|`RunManualTests`|Runs just the manual tests for the .NET Framework and .NET drivers|
42
44
|`BuildAkv`|Builds the Azure Key Vault Provider package for all supported platforms.|
43
45
44
-
45
46
### Parameters
47
+
48
+
The following parameters may be defined as MSBuild properties to configure the
49
+
build:
50
+
46
51
|Name|Supported Values|Default|Description|
47
52
|-|-|-|-|
48
53
|`Configuration`|`Debug`, `Release`|`Debug`|Sets the release configuration.|
49
-
|`BuildNetFx`|`true`, `false`|`true` (Windows), `false` (other)|If false, skips building the .NET Framework driver on Windows.|
50
54
|`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.|
51
55
|`Platform`|`AnyCPU`, `x86`, `x64`, `ARM`, `ARM64`|`AnyCPU`|May only be set when using package reference type or running tests.|
52
56
|`TestSet`|`1`, `2`, `3`, `AE`|all|Build or run a subset of the manual tests. Omit (default) to target all tests.|
53
57
|`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\)|
54
58
|`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.|
55
59
|`ResultsDirectory`|An absolute file path|./TestResults relative to current directory|Specifies where to write test results.|
56
60
57
-
58
61
## Example Workflows using MSBuild (Recommended)
62
+
59
63
Using the default configuration and running all tests:
@@ -117,7 +117,7 @@ Manual Tests require the below setup to run:
117
117
|AADSecurePrincipalSecret | (Optional) A Secret defined for a registered application which has been granted permission to the database defined in the AADPasswordConnectionString. | {Secret} |
|AzureKeyVaultTenantId | (Optional) The Azure Active Directory tenant (directory) Id of the service principal. |_{Tenant ID of Active Directory}_|
120
-
|SupportsIntegratedSecurity | (Optional) Whether or not the USER running tests has integrated security access to the target SQL Server.|`true` OR `false`|
120
+
|SupportsIntegratedSecurity | (Optional) Whether or not the USER running tests has integrated security access to the target SQL Server.|`true` OR `false`|
121
121
|LocalDbAppName | (Optional) If Local Db Testing is supported, this property configures the name of Local DB App instance available in client environment. Empty string value disables Local Db testing. | Name of Local Db App to connect to.|
122
122
|LocalDbSharedInstanceName | (Optional) If LocalDB testing is supported and the instance is shared, this property configures the name of the shared instance of LocalDB to connect to. | Name of shared instance of LocalDB. |
123
123
|FileStreamDirectory | (Optional) If File Stream is enabled on SQL Server, pass local directory path to be used for setting up File Stream enabled database. |`D:\\escaped\\absolute\\path\\to\\directory\\`|
@@ -128,15 +128,13 @@ Manual Tests require the below setup to run:
128
128
|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`. |
129
129
|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`|
130
130
131
-
132
131
## Example workflows using the Dotnet SDK
133
132
134
-
####Run Functional Tests
133
+
### Run Functional Tests
135
134
136
135
- Windows (`netfx x86`):
137
136
138
137
```bash
139
-
msbuild
140
138
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"
141
139
```
142
140
@@ -147,11 +145,11 @@ dotnet test "src\Microsoft.Data.SqlClient\tests\FunctionalTests\Microsoft.Data.S
147
145
```
148
146
149
147
- AnyCPU:
150
-
148
+
151
149
Project reference only builds Driver with `AnyCPU` platform, and underlying process decides to run the tests with a compatible architecture (x64, x86, ARM64).
152
150
153
151
Windows (`netcoreapp`):
154
-
152
+
155
153
```bash
156
154
dotnet test"src\Microsoft.Data.SqlClient\tests\FunctionalTests\Microsoft.Data.SqlClient.Tests.csproj" -p:Platform="AnyCPU" -p:Configuration="Release" -p:TestTargetOS="Windowsnetcoreapp" --no-build -v n --filter "category!=nonnetcoreapptests&category!=failing&category!=nonwindowstests"
157
155
```
@@ -161,7 +159,8 @@ dotnet test "src\Microsoft.Data.SqlClient\tests\FunctionalTests\Microsoft.Data.S
161
159
```bash
162
160
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"
163
161
```
164
-
#### Run Manual Tests
162
+
163
+
### Run Manual Tests
165
164
166
165
- Windows (`netfx x86`):
167
166
@@ -199,39 +198,73 @@ dotnet test "src/Microsoft.Data.SqlClient/tests/ManualTests/Microsoft.Data.SqlCl
199
198
dotnet test"src\Microsoft.Data.SqlClient\tests\ManualTests\Microsoft.Data.SqlClient.ManualTesting.Tests.csproj" -p:Platform="AnyCPU" -p:Configuration="Release" -p:TestTargetOS="Windowsnetcoreapp" --no-build -v n --filter "FullyQualifiedName=Microsoft.Data.SqlClient.ManualTesting.Tests.AlwaysEncrypted.CspProviderExt.TestKeysFromCertificatesCreatedWithMultipleCryptoProviders"
200
199
```
201
200
202
-
## Testing with Custom ReferenceType
201
+
## Testing with Package References
202
+
203
+
The MDS driver consists of several components, each of which produces its own
204
+
NuGet package. During development, components reference each other via
205
+
`<ProjectReference>` properties by default. This means that building
206
+
and testing one component will implicitly build its project referenced
207
+
dependencies.
203
208
204
-
Tests can be built and run with custom "Reference Type" property that enables different styles of testing:
209
+
Alternatively, the `ReferenceType` build property may be specified with a value
210
+
of `Package`. This will change inter-component dependencies to use
211
+
`<PackageReference>` dependencies, and require that dependent components be
212
+
built and packaged before building the depending component. In this scenario,
213
+
the root `NuGet.config` file must be updated to include the following entry
214
+
under the `<packageSources>` element:
205
215
206
-
- "Project" => Build and run tests with Microsoft.Data.SqlClient as Project Reference
207
-
- "Package" => Build and run tests with Microsoft.Data.SqlClient as Package Reference with configured "TestMicrosoftDataSqlClientVersion" in "Versions.props" file.
216
+
```xml
217
+
<configuration>
218
+
<packageSources>
219
+
...
220
+
<addkey="local"value="packages/" />
221
+
</packageSources>
222
+
</configuration>
223
+
```
208
224
209
-
> ************** IMPORTANT NOTE BEFORE PROCEEDING WITH "PACKAGE" REFERENCE TYPE ***************
210
-
> CREATE A NUGET PACKAGE WITH BELOW COMMAND AND ADD TO LOCAL FOLDER + UPDATE NUGET CONFIG FILE TO READ FROM THAT LOCATION
211
-
>
212
-
> ```bash
213
-
> msbuild -p:configuration=Release
214
-
>```
225
+
As a convenience, a `NuGet.config.local` file is supplied with the above
226
+
package source already present. You may simply copy it over `NuGet.config`
227
+
when using `Package` references.
215
228
216
-
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.
229
+
Then, you can specify `Package` references be used, for example:
There may be times where connection cannot be made to SQL Server, we found below ideas helpful:
300
-
301
-
- 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.
302
-
303
-
- 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:
0 commit comments