Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,10 @@ jobs:
uses: actions/setup-dotnet@v5.0.1
with:
global-json-file: global.json

- name: Restore dotnet tools
shell: bash
run: dotnet tool restore

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
Expand Down
10 changes: 9 additions & 1 deletion BUILDGUIDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,15 @@ This project should be built with Visual Studio 2019+ for the best compatibility

- **Visual Studio 2019** with imported components: [VS19Components](/tools/vsconfig/VS19Components.vsconfig)

- **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)
- **Powershell**: PowerShell is included as a .NET local tool in this repository. Running `dotnet tool restore` (see below) will make it available. No separate installation is required.
Comment thread
mdaigle marked this conversation as resolved.

### .NET Tools

This repository uses .NET local tools (e.g. PowerShell) that must be restored before building. Run the following from the repository root:

```bash
dotnet tool restore
```
Comment thread
mdaigle marked this conversation as resolved.

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

Expand Down
7 changes: 7 additions & 0 deletions dotnet-tools.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,13 @@
"apicompat"
],
"rollForward": false
},
"powershell": {
"version": "7.6.0",
"commands": [
"pwsh"
],
"rollForward": false
Comment thread
mdaigle marked this conversation as resolved.
}
}
}
3 changes: 3 additions & 0 deletions eng/pipelines/common/templates/jobs/ci-build-nugets-job.yml
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,9 @@ jobs:
# Install the .NET SDK.
- template: /eng/pipelines/steps/install-dotnet.yml@self

# Restore dotnet CLI tools (e.g. pwsh, apicompat) before building.
- template: /eng/pipelines/steps/restore-dotnet-tools.yml@self

# When we're performing a Debug build, we still want to try _compiling_ the
# code in Release mode to ensure downstream pipelines don't encounter
# compilation errors. We won't use the Release artifacts for anything else
Expand Down
3 changes: 3 additions & 0 deletions eng/pipelines/common/templates/jobs/ci-run-tests-job.yml
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,9 @@ jobs:
${{ else }}:
runtimes: [8.x, 9.x]

# Restore dotnet CLI tools (e.g. pwsh, apicompat) before building.
- template: /eng/pipelines/steps/restore-dotnet-tools.yml@self

- ${{ if ne(parameters.prebuildSteps, '') }}:
- ${{ parameters.prebuildSteps }} # extra steps to run before the build like downloading sni and the required configuration

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,9 @@ jobs:
# Install the .NET SDK.
- template: /eng/pipelines/steps/install-dotnet.yml@self

# Restore dotnet CLI tools (e.g. pwsh, apicompat) before building.
- template: /eng/pipelines/steps/restore-dotnet-tools.yml@self

# Perform Roslyn analysis before building, since this step will clobber build output.
- template: /eng/pipelines/onebranch/steps/roslyn-analyzers-csproj-step.yml@self
parameters:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,9 @@ jobs:
# Install the .NET SDK
- template: /eng/pipelines/steps/install-dotnet.yml@self

# Restore dotnet CLI tools (e.g. pwsh, apicompat) before building.
- template: /eng/pipelines/steps/restore-dotnet-tools.yml@self

# Perform analysis before building, since this step will clobber build output
- template: /eng/pipelines/onebranch/steps/roslyn-analyzers-sqlclient-step.yml@self
parameters:
Expand Down
14 changes: 14 additions & 0 deletions eng/pipelines/steps/restore-dotnet-tools.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#################################################################################
# Licensed to the .NET Foundation under one or more agreements. #
# The .NET Foundation licenses this file to you under the MIT license. #
# See the LICENSE file in the project root for more information. #
#################################################################################

# Restores dotnet CLI tools defined in dotnet-tools.json.
# This step should be invoked after install-dotnet.yml and before any build
# steps that depend on the restored tools (e.g. pwsh, apicompat).

steps:
- script: dotnet tool restore
displayName: Restore .NET Tools
workingDirectory: $(Build.SourcesDirectory)
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
<OutputPath>$(ArtifactPath)$(AssemblyName).ref/$(ReferenceType)-$(Configuration)/</OutputPath>
</PropertyGroup>


<!-- Trim Docs for IntelliSense ====================================== -->
<!--
It has been determined that including the remarks section in IntelliSense docs looks bad in
Expand All @@ -48,10 +49,8 @@
AfterTargets="Build"
Condition="'$(IsCrossTargetingBuild)' != 'true' AND '$(GenerateDocumentationFile)' == 'true'">
<PropertyGroup>
<PowerShellCommand Condition="'$(OS)' == 'Windows_NT'">powershell.exe</PowerShellCommand>
<PowerShellCommand Condition="'$(OS)' != 'Windows_NT'">pwsh</PowerShellCommand>
<PowerShellCommand>
$(PowerShellCommand)
dotnet pwsh
Comment thread
mdaigle marked this conversation as resolved.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For dotnet commands, our entry point to them has been build(2).proj, and in those files, we have a way to override the path to dotnet. With this change, the path to dotnet can't be overridden. Whether that's acceptable or not is up for discussion, but we already have pipeline mechanisms that use the dotnet override for x86 behavior.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see what you mean, but this step isn't architecture sensitive. Whatever dotnet version is on the path works just fine.

-NonInteractive
-ExecutionPolicy Unrestricted
-Command "$(RepoRoot)tools\intellisense\TrimDocs.ps1 -inputFile '$(DocumentationFile)' -outputFile '$(DocumentationFile)'"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,8 @@ public void SimpleFillTest()

// TODO Synapse: Remove Northwind dependency by creating required tables in setup.
[ConditionalFact(typeof(DataTestUtility), nameof(DataTestUtility.AreConnStringsSetup), nameof(DataTestUtility.IsNotAzureSynapse))]
// https://github.com/dotnet/SqlClient/issues/4135
[Trait("Category", "flaky")]
public void FillShouldAllowRetryLogicProviderToBeInvoked()
{
int maxRetries = 3;
Expand Down
9 changes: 1 addition & 8 deletions tools/targets/CompareMdsRefAssemblies.targets
Original file line number Diff line number Diff line change
Expand Up @@ -112,13 +112,6 @@
Text="Baseline ref assemblies available at $(BaselineExtractDir)ref\" />
</Target>

<!-- ================================================================== -->
<!-- _RestoreTools -->
<!-- ================================================================== -->
<Target Name="_RestoreTools" DependsOnTargets="_SetApiCompatProperties">
<Exec Command="dotnet tool restore" WorkingDirectory="$(RepoRoot)" />
</Target>

<!-- ================================================================== -->
<!-- _BuildLegacyRefNetFx -->
<!-- ================================================================== -->
Expand Down Expand Up @@ -155,7 +148,7 @@
<!-- _RunRefApiCompat -->
<!-- ================================================================== -->
<Target Name="_RunRefApiCompat"
DependsOnTargets="_DownloadBaselinePackage;_RestoreTools;_BuildLegacyRefNetFx;_BuildLegacyRefNetCore;_BuildNewRefProject">
DependsOnTargets="_DownloadBaselinePackage;_BuildLegacyRefNetFx;_BuildLegacyRefNetCore;_BuildNewRefProject">

Comment thread
mdaigle marked this conversation as resolved.
<!--
For each TFM, compare:
Expand Down
3 changes: 1 addition & 2 deletions tools/targets/TrimDocsForIntelliSense.targets
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ The .NET Foundation licenses this file to you under the MIT license. -->
<Project>
<!-- This target runs after Build, and trims XML documentation generated in the $(OutputPath) of the project where this target is included.-->
<Target Name="TrimDocsForIntelliSense" AfterTargets="Build" Condition="'$(GenerateDocumentationFile)' == 'true'">
<Exec Command="powershell.exe -NonInteractive -ExecutionPolicy Unrestricted -Command &quot;$(ToolsDir)intellisense\TrimDocs.ps1 -inputFile &apos;$(OutputPath)\Microsoft.Data.SqlClient.xml&apos; -outputFile &apos;$(OutputPath)\Microsoft.Data.SqlClient.xml&apos;&quot;" Condition=" '$(OS)' == 'Windows_NT' " />
<Exec Command="pwsh -NonInteractive -ExecutionPolicy Unrestricted -Command &quot;$(ToolsDir)intellisense\TrimDocs.ps1 -inputFile &apos;$(OutputPath)\Microsoft.Data.SqlClient.xml&apos; -outputFile &apos;$(OutputPath)\Microsoft.Data.SqlClient.xml&apos;&quot;" Condition=" '$(OS)' != 'Windows_NT' " />
<Exec Command="dotnet pwsh -NonInteractive -ExecutionPolicy Unrestricted -Command &quot;$(ToolsDir)intellisense\TrimDocs.ps1 -inputFile &apos;$(OutputPath)\Microsoft.Data.SqlClient.xml&apos; -outputFile &apos;$(OutputPath)\Microsoft.Data.SqlClient.xml&apos;&quot;" />
</Target>
</Project>
Loading