diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index 75e4411e4b..45890dfdf4 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -72,6 +72,10 @@ jobs: uses: actions/setup-dotnet@v5.2.0 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 diff --git a/BUILDGUIDE.md b/BUILDGUIDE.md index a927945c05..073f6afc68 100644 --- a/BUILDGUIDE.md +++ b/BUILDGUIDE.md @@ -19,15 +19,22 @@ on operating systems that do not support .NET Framework. As such, it is not nece ### Miscellaneous -**PowerShell** is required to run several miscellaneous tasks as part of building and packaging. On -Windows systems, either the built-in `powershell.exe` will be used, or if installed, the modern -`pwsh` will be used. On Linux and macOS systems, the `pwsh` command is required to be in the `$PATH` -environment variable. For specific instructions see: [Install -PowerShell](https://learn.microsoft.com/en-us/powershell/scripting/install/install-powershell) +**PowerShell** is included as a .NET local tool in this repository. Running `dotnet tool restore` +(see below) will make it available via `dotnet tool run pwsh -- `. Note that `pwsh` is not +added to PATH — it must be invoked through `dotnet tool run`. Build targets handle this +automatically; manual invocation is only needed for ad-hoc scripting. The **NuGet** binary is optional for inspection and feed-management workflows, but build and packaging flows in this repository are run through `dotnet build` against `build.proj`. +### .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 +``` + ## Developer Workflow Once you've cloned the repository and made your changes to the codebase, it is time to build, test, and optionally diff --git a/dotnet-tools.json b/dotnet-tools.json index 1f59e06063..11e3494512 100644 --- a/dotnet-tools.json +++ b/dotnet-tools.json @@ -15,6 +15,13 @@ "apicompat" ], "rollForward": false + }, + "powershell": { + "version": "7.6.0", + "commands": [ + "pwsh" + ], + "rollForward": false } } } \ No newline at end of file diff --git a/eng/pipelines/common/templates/jobs/ci-build-nugets-job.yml b/eng/pipelines/common/templates/jobs/ci-build-nugets-job.yml index 8d051e5167..1ea748d99a 100644 --- a/eng/pipelines/common/templates/jobs/ci-build-nugets-job.yml +++ b/eng/pipelines/common/templates/jobs/ci-build-nugets-job.yml @@ -118,6 +118,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 diff --git a/eng/pipelines/common/templates/jobs/ci-run-tests-job.yml b/eng/pipelines/common/templates/jobs/ci-run-tests-job.yml index 5c593e11e3..85ed54dfd6 100644 --- a/eng/pipelines/common/templates/jobs/ci-run-tests-job.yml +++ b/eng/pipelines/common/templates/jobs/ci-run-tests-job.yml @@ -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 diff --git a/eng/pipelines/steps/restore-dotnet-tools.yml b/eng/pipelines/steps/restore-dotnet-tools.yml new file mode 100644 index 0000000000..b213583e82 --- /dev/null +++ b/eng/pipelines/steps/restore-dotnet-tools.yml @@ -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) diff --git a/src/Microsoft.Data.SqlClient/ref/Microsoft.Data.SqlClient.csproj b/src/Microsoft.Data.SqlClient/ref/Microsoft.Data.SqlClient.csproj index 0b6282965d..611b41d6f0 100644 --- a/src/Microsoft.Data.SqlClient/ref/Microsoft.Data.SqlClient.csproj +++ b/src/Microsoft.Data.SqlClient/ref/Microsoft.Data.SqlClient.csproj @@ -41,6 +41,7 @@ $(ArtifactPath)$(AssemblyName).ref/$(ReferenceType)-$(Configuration)/ + + + + + + + + + - powershell.exe - pwsh - $(PowerShellCommand) + dotnet tool run pwsh -- -NonInteractive -ExecutionPolicy Unrestricted -Command "$(RepoRoot)tools\intellisense\TrimDocs.ps1 -inputFile '$(DocumentationFile)' -outputFile '$(DocumentationFile)'" diff --git a/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/AdapterTest/AdapterTest.cs b/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/AdapterTest/AdapterTest.cs index 9bf5351a83..798890c3fa 100644 --- a/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/AdapterTest/AdapterTest.cs +++ b/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/AdapterTest/AdapterTest.cs @@ -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; diff --git a/tools/targets/CompareMdsRefAssemblies.targets b/tools/targets/CompareMdsRefAssemblies.targets index bccfa00930..47caaa7a56 100644 --- a/tools/targets/CompareMdsRefAssemblies.targets +++ b/tools/targets/CompareMdsRefAssemblies.targets @@ -59,10 +59,24 @@ Text="BaselinePackageVersion is required. Specify the published MDS NuGet package version to compare against, e.g.: /p:BaselinePackageVersion=6.1.4" /> + + + + + + + + + + - + - - - - - - - @@ -111,7 +118,7 @@ + DependsOnTargets="_DownloadBaselinePackage;_BuildRefProject">