diff --git a/.config/dotnet-tools.json b/.config/dotnet-tools.json
new file mode 100644
index 000000000..151689b63
--- /dev/null
+++ b/.config/dotnet-tools.json
@@ -0,0 +1,30 @@
+{
+ "version": 1,
+ "isRoot": true,
+ "tools": {
+ "powershell": {
+ "version": "7.3.4",
+ "commands": [
+ "pwsh"
+ ]
+ },
+ "dotnet-format": {
+ "version": "5.1.250801",
+ "commands": [
+ "dotnet-format"
+ ]
+ },
+ "dotnet-coverage": {
+ "version": "17.7.0",
+ "commands": [
+ "dotnet-coverage"
+ ]
+ },
+ "nbgv": {
+ "version": "3.5.119",
+ "commands": [
+ "nbgv"
+ ]
+ }
+ }
+}
diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile
index be43e284c..01c94a90e 100644
--- a/.devcontainer/Dockerfile
+++ b/.devcontainer/Dockerfile
@@ -1,4 +1,5 @@
-FROM mcr.microsoft.com/dotnet/sdk:6.0.403-focal
+# Refer to https://hub.docker.com/_/microsoft-dotnet-sdk for available versions
+FROM mcr.microsoft.com/dotnet/sdk:7.0.203-jammy
# Installing mono makes `dotnet test` work without errors even for net472.
# But installing it takes a long time, so it's excluded by default.
diff --git a/.editorconfig b/.editorconfig
index 724ea62b5..e0b8f0331 100644
--- a/.editorconfig
+++ b/.editorconfig
@@ -19,12 +19,12 @@ indent_size = 4
insert_final_newline = true
trim_trailing_whitespace = true
-# Xml project files
-[*.{csproj,vbproj,vcxproj,vcxproj.filters,proj,projitems,shproj,msbuildproj}]
+# MSBuild project files
+[*.{csproj,vbproj,vcxproj,vcxproj.filters,proj,projitems,shproj,msbuildproj,props,targets}]
indent_size = 2
# Xml config files
-[*.{props,targets,ruleset,config,nuspec,resx,vsixmanifest,vsct,runsettings}]
+[*.{ruleset,config,nuspec,resx,vsixmanifest,vsct,runsettings}]
indent_size = 2
# JSON files
diff --git a/.gitattributes b/.gitattributes
index c22a129ef..1f35e683d 100644
--- a/.gitattributes
+++ b/.gitattributes
@@ -7,6 +7,9 @@
*.sh eol=lf
*.ps1 eol=lf
+# The macOS codesign tool is extremely picky, and requires LF line endings.
+*.plist eol=lf
+
###############################################################################
# Set default behavior for command prompt diff.
#
diff --git a/.gitignore b/.gitignore
index 3bb499198..69599b879 100644
--- a/.gitignore
+++ b/.gitignore
@@ -349,3 +349,6 @@ MigrationBackup/
# dotnet tool local install directory
.store/
+
+# mac-created file to track user view preferences for a directory
+.DS_Store
diff --git a/.vscode/extensions.json b/.vscode/extensions.json
index 853a3d453..c4ddc1a71 100644
--- a/.vscode/extensions.json
+++ b/.vscode/extensions.json
@@ -12,7 +12,8 @@
"davidanson.vscode-markdownlint",
"dotjoshjohnson.xml",
"ms-vscode-remote.remote-containers",
- "ms-azuretools.vscode-docker"
+ "ms-azuretools.vscode-docker",
+ "tintoy.msbuild-project-tools"
],
// List of extensions recommended by VS Code that should not be recommended for users of this workspace.
"unwantedRecommendations": []
diff --git a/Directory.Build.props b/Directory.Build.props
index 46896a515..22caf1d1c 100644
--- a/Directory.Build.props
+++ b/Directory.Build.props
@@ -6,7 +6,7 @@
$(RepoRootPath)bin\$(MSBuildProjectName)\
$(RepoRootPath)bin\Packages\$(Configuration)\
$(MSBuildThisFileDirectory)..\wiki\api
- 10.0
+ latest
enable
latest
@@ -17,6 +17,10 @@
true
+
+
+ false
+
$(MSBuildThisFileDirectory)
@@ -25,11 +29,10 @@
true
$(MSBuildThisFileDirectory)strongname.snk
+ https://github.com/dotnet/Nerdbank.GitVersioning
Andrew Arnott
- aarnott
git commit versioning version assemblyinfo
Copyright (c) .NET Foundation and Contributors
- https://github.com/dotnet/Nerdbank.GitVersioning
MIT
true
true
@@ -39,19 +42,9 @@
2.0.315-alpha.0.9
-
-
-
-
-
-
-
-
-
-
@@ -63,7 +56,7 @@
- https://github.com/dotnet/Nerdbank.GitVersioning/releases/tag/v$(Version)
+ $(PackageProjectUrl)/releases/tag/v$(Version)
@@ -74,23 +67,15 @@
- <_WpfTempProjectNuGetFilePathNoExt>$(BaseIntermediateOutputPath)..\$(_TargetAssemblyProjectName)\$(_TargetAssemblyProjectName)$(MSBuildProjectExtension).nuget.g
-
false
false
false
false
-
-
-
diff --git a/Directory.Build.targets b/Directory.Build.targets
index 65a15bfc8..ea7b6e6f8 100644
--- a/Directory.Build.targets
+++ b/Directory.Build.targets
@@ -4,5 +4,8 @@
false
-
+
+
+
+
diff --git a/Directory.Packages.props b/Directory.Packages.props
new file mode 100644
index 000000000..cd1aace61
--- /dev/null
+++ b/Directory.Packages.props
@@ -0,0 +1,51 @@
+
+
+
+ true
+ true
+ 0.13.2
+ 16.9.0
+ 15.9.20
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Nerdbank.GitVersioning.sln b/Nerdbank.GitVersioning.sln
index 78d6ef595..09148d662 100644
--- a/Nerdbank.GitVersioning.sln
+++ b/Nerdbank.GitVersioning.sln
@@ -12,6 +12,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
build.ps1 = build.ps1
Directory.Build.props = Directory.Build.props
Directory.Build.targets = Directory.Build.targets
+ Directory.Packages.props = Directory.Packages.props
global.json = global.json
init.ps1 = init.ps1
nuget.config = nuget.config
diff --git a/azure-pipelines.yml b/azure-pipelines.yml
index 2bac596a5..8ab8348e1 100644
--- a/azure-pipelines.yml
+++ b/azure-pipelines.yml
@@ -31,7 +31,7 @@ resources:
image: mcr.microsoft.com/dotnet/sdk:latest
variables:
- TreatWarningsAsErrors: true
+ MSBuildTreatWarningsAsErrors: true
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true
BuildConfiguration: Release
codecov_token: 92266a45-648d-454e-8fec-beffae2e6553
@@ -103,11 +103,13 @@ stages:
steps:
- checkout: self
fetchDepth: 0 # avoid shallow clone so nbgv can do its work.
+ clean: true
+ submodules: true # keep the warnings quiet about the wiki not being enlisted
- task: UseDotNet@2
- displayName: Install .NET 6.0.403 SDK
+ displayName: Install .NET 7.0.203 SDK
inputs:
packageType: sdk
- version: 6.0.403
+ version: 7.0.203
- script: dotnet --info
displayName: Show dotnet SDK info
- bash: |
@@ -121,7 +123,7 @@ stages:
dotnet build -c Release
displayName: Build in Release mode
- script: |
- dotnet run -c Release -f net6.0 -- --filter *GetVersionBenchmarks* --artifacts $(Build.ArtifactStagingDirectory)/benchmarks/packed/$(imageName)
+ dotnet run -c Release -f net7.0 -- --filter *GetVersionBenchmarks* --artifacts $(Build.ArtifactStagingDirectory)/benchmarks/packed/$(imageName)
workingDirectory: test/Nerdbank.GitVersioning.Benchmarks
displayName: Run benchmarks (packed)
- bash: |
@@ -138,7 +140,7 @@ stages:
git unpack-objects < .git/objects/pack/*.pack
displayName: Unpack Git repositories
- script: |
- dotnet run -c Release -f net6.0 -- --filter '*GetVersionBenchmarks*' --artifacts $(Build.ArtifactStagingDirectory)/benchmarks/unpacked/$(imageName)
+ dotnet run -c Release -f net7.0 -- --filter '*GetVersionBenchmarks*' --artifacts $(Build.ArtifactStagingDirectory)/benchmarks/unpacked/$(imageName)
workingDirectory: test/Nerdbank.GitVersioning.Benchmarks
displayName: Run benchmarks (unpacked)
- task: PublishBuildArtifacts@1
diff --git a/azure-pipelines/Get-NuGetTool.ps1 b/azure-pipelines/Get-NuGetTool.ps1
index 4431adb91..3097c8736 100644
--- a/azure-pipelines/Get-NuGetTool.ps1
+++ b/azure-pipelines/Get-NuGetTool.ps1
@@ -6,7 +6,7 @@
#>
Param(
[Parameter()]
- [string]$NuGetVersion='5.2.0'
+ [string]$NuGetVersion='6.4.0'
)
$toolsPath = & "$PSScriptRoot\Get-TempToolsPath.ps1"
diff --git a/azure-pipelines/Get-nbgv.ps1 b/azure-pipelines/Get-nbgv.ps1
deleted file mode 100644
index a5be2cf7c..000000000
--- a/azure-pipelines/Get-nbgv.ps1
+++ /dev/null
@@ -1,24 +0,0 @@
-<#
-.SYNOPSIS
- Gets the path to the nbgv CLI tool, installing it if necessary.
-#>
-Param(
-)
-
-$existingTool = Get-Command "nbgv" -ErrorAction SilentlyContinue
-if ($existingTool) {
- return $existingTool.Path
-}
-
-$toolInstallDir = & "$PSScriptRoot/Get-TempToolsPath.ps1"
-
-$toolPath = "$toolInstallDir/nbgv"
-if (!(Test-Path $toolInstallDir)) { New-Item -Path $toolInstallDir -ItemType Directory | Out-Null }
-
-if (!(Get-Command $toolPath -ErrorAction SilentlyContinue)) {
- Write-Host "Installing nbgv to $toolInstallDir"
- dotnet tool install --tool-path "$toolInstallDir" nbgv --configfile "$PSScriptRoot/justnugetorg.nuget.config" | Out-Null
-}
-
-# Normalize the path on the way out.
-return (Get-Command $toolPath).Path
diff --git a/azure-pipelines/Merge-CodeCoverage.ps1 b/azure-pipelines/Merge-CodeCoverage.ps1
index 9fe925cf6..5ecabbc9b 100644
--- a/azure-pipelines/Merge-CodeCoverage.ps1
+++ b/azure-pipelines/Merge-CodeCoverage.ps1
@@ -20,32 +20,32 @@ Param(
)
$RepoRoot = [string](Resolve-Path $PSScriptRoot/..)
-
-if (!(Test-Path $RepoRoot/obj/dotnet-coverage*)) {
- dotnet tool install --tool-path $RepoRoot/obj dotnet-coverage --version 17.4.3 --configfile $PSScriptRoot/justnugetorg.nuget.config
-}
-
-Write-Verbose "Searching $Path for *.cobertura.xml files"
-$reports = Get-ChildItem -Recurse $Path -Filter *.cobertura.xml
-
-if ($reports) {
- $reports |% { $_.FullName } |% {
- # In addition to replacing {reporoot}, we also normalize on one kind of slash so that the report aggregates data for a file whether data was collected on Windows or not.
- $xml = [xml](Get-Content -Path $_)
- $xml.coverage.packages.package.classes.class |? { $_.filename} |% {
- $_.filename = $_.filename.Replace('{reporoot}', $RepoRoot).Replace([IO.Path]::AltDirectorySeparatorChar, [IO.Path]::DirectorySeparatorChar)
+Push-Location $RepoRoot
+try {
+ Write-Verbose "Searching $Path for *.cobertura.xml files"
+ $reports = Get-ChildItem -Recurse $Path -Filter *.cobertura.xml
+
+ if ($reports) {
+ $reports |% { $_.FullName } |% {
+ # In addition to replacing {reporoot}, we also normalize on one kind of slash so that the report aggregates data for a file whether data was collected on Windows or not.
+ $xml = [xml](Get-Content -Path $_)
+ $xml.coverage.packages.package.classes.class |? { $_.filename} |% {
+ $_.filename = $_.filename.Replace('{reporoot}', $RepoRoot).Replace([IO.Path]::AltDirectorySeparatorChar, [IO.Path]::DirectorySeparatorChar)
+ }
+
+ $xml.Save($_)
}
- $xml.Save($_)
- }
+ $Inputs = $reports |% { Resolve-Path -relative $_.FullName }
- $Inputs = $reports |% { Resolve-Path -relative $_.FullName }
+ if ((Split-Path $OutputFile) -and -not (Test-Path (Split-Path $OutputFile))) {
+ New-Item -Type Directory -Path (Split-Path $OutputFile) | Out-Null
+ }
- if (Split-Path $OutputFile) {
- New-Item -Type Directory -Path (Split-Path $OutputFile) | Out-Null
+ & dotnet tool run dotnet-coverage merge $Inputs -o $OutputFile -f cobertura
+ } else {
+ Write-Error "No reports found to merge."
}
-
- & "$RepoRoot/obj/dotnet-coverage" merge $Inputs -o $OutputFile -f cobertura
-} else {
- Write-Error "No reports found to merge."
+} finally {
+ Pop-Location
}
diff --git a/azure-pipelines/artifacts/_all.ps1 b/azure-pipelines/artifacts/_all.ps1
index 033cc87c9..9a22a1d08 100644
--- a/azure-pipelines/artifacts/_all.ps1
+++ b/azure-pipelines/artifacts/_all.ps1
@@ -38,6 +38,7 @@ Get-ChildItem "$PSScriptRoot\*.ps1" -Exclude "_*" -Recurse | % {
$ArtifactName = $_.BaseName
if ($Force -or !(Test-ArtifactStaged($ArtifactName + $ArtifactNameSuffix))) {
$totalFileCount = 0
+ Write-Verbose "Collecting file list for artifact $($_.BaseName)"
$fileGroups = & $_
if ($fileGroups) {
$fileGroups.GetEnumerator() | % {
diff --git a/azure-pipelines/build.yml b/azure-pipelines/build.yml
index 1070ad611..021256aeb 100644
--- a/azure-pipelines/build.yml
+++ b/azure-pipelines/build.yml
@@ -23,12 +23,9 @@ jobs:
- template: install-dependencies.yml
- pwsh: |
Invoke-WebRequest -Uri "https://dot.net/v1/dotnet-install.ps1" -OutFile dotnet-install.ps1
- & .\dotnet-install.ps1 -Architecture x86 -Version 6.0.403 -InstallDir "C:\Program Files (x86)\dotnet\" -NoPath -Verbose
+ & .\dotnet-install.ps1 -Architecture x86 -Version 7.0.203 -InstallDir "C:\Program Files (x86)\dotnet\" -NoPath -Verbose
displayName: ⚙ Install 32-bit .NET SDK and runtimes
- - powershell: '& (./azure-pipelines/Get-nbgv.ps1) cloud -c'
- displayName: ⚙ Set build number
-
- template: dotnet.yml
parameters:
RunTests: ${{ parameters.RunTests }}
@@ -42,6 +39,8 @@ jobs:
clean: true
submodules: true # keep the warnings quiet about the wiki not being enlisted
- template: install-dependencies.yml
+ - powershell: dotnet tool run nbgv cloud -c
+ displayName: ⚙ Set build number
- template: dotnet.yml
parameters:
RunTests: ${{ parameters.RunTests }}
diff --git a/azure-pipelines/dotnet.yml b/azure-pipelines/dotnet.yml
index 3fe2e61b3..92ffd9701 100644
--- a/azure-pipelines/dotnet.yml
+++ b/azure-pipelines/dotnet.yml
@@ -6,21 +6,21 @@ steps:
- script: |
git config --global user.name ci
git config --global user.email me@ci.com
- displayName: Configure git commit author for testing
+ displayName: ⚙️ Configure git commit author for testing
- script: dotnet build -t:build,pack --no-restore -c $(BuildConfiguration) /bl:"$(Build.ArtifactStagingDirectory)/build_logs/build.binlog"
displayName: 🛠 dotnet build
- script: dotnet pack -c $(BuildConfiguration) --no-build -p:PackLKG=true /bl:"$(Build.ArtifactStagingDirectory)/build_logs/msbuild_lkg.binlog"
- displayName: Build LKG package
+ displayName: 🛠️ Build LKG package
workingDirectory: src/Nerdbank.GitVersioning.Tasks
- script: dotnet publish -c $(BuildConfiguration) -o ../nerdbank-gitversioning.npm/out/nbgv.cli/tools/net6.0/any /bl:"$(Build.ArtifactStagingDirectory)/build_logs/nbgv_publish.binlog"
- displayName: Publish nbgv tool
+ displayName: 📢 Publish nbgv tool
workingDirectory: src/nbgv
- script: yarn build
- displayName: Build nerdbank-gitversioning NPM package
+ displayName: 🛠️ Build nerdbank-gitversioning NPM package
workingDirectory: src/nerdbank-gitversioning.npm
- powershell: azure-pipelines/dotnet-test-cloud.ps1 -Configuration $(BuildConfiguration) -Agent $(Agent.JobName) -PublishResults
diff --git a/azure-pipelines/test.runsettings b/azure-pipelines/test.runsettings
index c69022fc0..4e24a0a65 100644
--- a/azure-pipelines/test.runsettings
+++ b/azure-pipelines/test.runsettings
@@ -31,9 +31,9 @@
False
- True
+ False
- True
+ False
True
diff --git a/azure-pipelines/variables/_pipelines.ps1 b/azure-pipelines/variables/_pipelines.ps1
index 951106d2d..11748b81b 100644
--- a/azure-pipelines/variables/_pipelines.ps1
+++ b/azure-pipelines/variables/_pipelines.ps1
@@ -14,7 +14,7 @@ param (
(& "$PSScriptRoot\_all.ps1").GetEnumerator() |% {
# Always use ALL CAPS for env var names since Azure Pipelines converts variable names to all caps and on non-Windows OS, env vars are case sensitive.
$keyCaps = $_.Key.ToUpper()
- if (Test-Path -Path "env:$keyCaps") {
+ if ((Test-Path "env:$keyCaps") -and (Get-Content "env:$keyCaps")) {
Write-Host "Skipping setting $keyCaps because variable is already set to '$(Get-Content env:$keyCaps)'." -ForegroundColor Cyan
} else {
Write-Host "$keyCaps=$($_.Value)" -ForegroundColor Yellow
diff --git a/global.json b/global.json
index 7b09693cc..c7d7e468c 100644
--- a/global.json
+++ b/global.json
@@ -1,6 +1,6 @@
{
"sdk": {
- "version": "6.0.403",
+ "version": "7.0.203",
"rollForward": "patch",
"allowPrerelease": false
}
diff --git a/init.ps1 b/init.ps1
index 60a7010f2..062c8c85a 100755
--- a/init.ps1
+++ b/init.ps1
@@ -28,8 +28,12 @@
No effect if -NoPrerequisites is specified.
.PARAMETER NoRestore
Skips the package restore step.
+.PARAMETER NoToolRestore
+ Skips the dotnet tool restore step.
.PARAMETER AccessToken
An optional access token for authenticating to Azure Artifacts authenticated feeds.
+.PARAMETER Interactive
+ Runs NuGet restore in interactive mode. This can turn authentication failures into authentication challenges.
#>
[CmdletBinding(SupportsShouldProcess = $true)]
Param (
@@ -44,7 +48,11 @@ Param (
[Parameter()]
[switch]$NoRestore,
[Parameter()]
- [string]$AccessToken
+ [switch]$NoToolRestore,
+ [Parameter()]
+ [string]$AccessToken,
+ [Parameter()]
+ [switch]$Interactive
)
$EnvVars = @{}
@@ -76,13 +84,26 @@ try {
$HeaderColor = 'Green'
if (!$NoRestore -and $PSCmdlet.ShouldProcess("NuGet packages", "Restore")) {
+ $RestoreArguments = @()
+ if ($Interactive)
+ {
+ $RestoreArguments += '--interactive'
+ }
+
Write-Host "Restoring NuGet packages" -ForegroundColor $HeaderColor
- dotnet restore
+ dotnet restore @RestoreArguments
if ($lastexitcode -ne 0) {
throw "Failure while restoring packages."
}
}
+ if (!$NoToolRestore -and $PSCmdlet.ShouldProcess("dotnet tool", "restore")) {
+ dotnet tool restore @RestoreArguments
+ if ($lastexitcode -ne 0) {
+ throw "Failure while restoring dotnet CLI tools."
+ }
+ }
+
if (!$NoRestore -and $PSCmdlet.ShouldProcess("NPM packages", "Restore")) {
Write-Host "Installing yarn" -ForegroundColor Yellow
npm i -g yarn@">=1.22 <2.0"
diff --git a/nuget.config b/nuget.config
index e61343aac..b60f26be9 100644
--- a/nuget.config
+++ b/nuget.config
@@ -2,29 +2,23 @@
-
+
-
+
-
-
- Microsoft;aarnott;xunit;kzu;castleproject;patrickb8man;jamesnk;ethomson;AndreyAkinshin;MarcoRossignoli;cake-build;ericnewton76;0xd4d;manuel.roemer;Thecentury;sharwell;dotnetfoundation;wtfsck
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
diff --git a/src/Cake.GitVersioning/Cake.GitVersioning.csproj b/src/Cake.GitVersioning/Cake.GitVersioning.csproj
index d5759726c..7c978f077 100644
--- a/src/Cake.GitVersioning/Cake.GitVersioning.csproj
+++ b/src/Cake.GitVersioning/Cake.GitVersioning.csproj
@@ -28,9 +28,9 @@
-
-
-
+
+
+
diff --git a/src/Directory.Build.props b/src/Directory.Build.props
index 77d947658..052fe3ef0 100644
--- a/src/Directory.Build.props
+++ b/src/Directory.Build.props
@@ -1,3 +1,3 @@
-
+
diff --git a/src/Directory.Build.targets b/src/Directory.Build.targets
index 566ab4fcf..c1d929a5b 100644
--- a/src/Directory.Build.targets
+++ b/src/Directory.Build.targets
@@ -3,5 +3,5 @@
-
+
diff --git a/src/NerdBank.GitVersioning/ManagedGit/FileHelpers.cs b/src/NerdBank.GitVersioning/ManagedGit/FileHelpers.cs
index 2d33693ec..e370debaa 100644
--- a/src/NerdBank.GitVersioning/ManagedGit/FileHelpers.cs
+++ b/src/NerdBank.GitVersioning/ManagedGit/FileHelpers.cs
@@ -5,7 +5,6 @@
using System.Diagnostics.CodeAnalysis;
using System.Runtime.InteropServices;
-using System.Runtime.Versioning;
using Microsoft.Win32.SafeHandles;
using Windows.Win32;
using Windows.Win32.Foundation;
diff --git a/src/NerdBank.GitVersioning/Nerdbank.GitVersioning.csproj b/src/NerdBank.GitVersioning/Nerdbank.GitVersioning.csproj
index d163c2c05..54346b178 100644
--- a/src/NerdBank.GitVersioning/Nerdbank.GitVersioning.csproj
+++ b/src/NerdBank.GitVersioning/Nerdbank.GitVersioning.csproj
@@ -9,14 +9,14 @@
Nerdbank.GitVersioning
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
diff --git a/src/Nerdbank.GitVersioning.Tasks/Nerdbank.GitVersioning.Tasks.csproj b/src/Nerdbank.GitVersioning.Tasks/Nerdbank.GitVersioning.Tasks.csproj
index d4e8d7c82..da3e1629b 100644
--- a/src/Nerdbank.GitVersioning.Tasks/Nerdbank.GitVersioning.Tasks.csproj
+++ b/src/Nerdbank.GitVersioning.Tasks/Nerdbank.GitVersioning.Tasks.csproj
@@ -41,17 +41,17 @@
-
+
-
+
-
-
+
+
diff --git a/src/nbgv/nbgv.csproj b/src/nbgv/nbgv.csproj
index 4042b1989..8dfcf1255 100644
--- a/src/nbgv/nbgv.csproj
+++ b/src/nbgv/nbgv.csproj
@@ -10,11 +10,11 @@
-
-
-
-
-
+
+
+
+
+
diff --git a/test/Cake.GitVersioning.Tests/Cake.GitVersioning.Tests.csproj b/test/Cake.GitVersioning.Tests/Cake.GitVersioning.Tests.csproj
index 44c7e2196..e79d49313 100644
--- a/test/Cake.GitVersioning.Tests/Cake.GitVersioning.Tests.csproj
+++ b/test/Cake.GitVersioning.Tests/Cake.GitVersioning.Tests.csproj
@@ -15,11 +15,10 @@
-
-
-
-
-
+
+
+
+
diff --git a/test/Directory.Build.props b/test/Directory.Build.props
index 449a06e45..ad4a4b6c5 100644
--- a/test/Directory.Build.props
+++ b/test/Directory.Build.props
@@ -1,5 +1,5 @@
-
+
false
diff --git a/test/Directory.Build.targets b/test/Directory.Build.targets
index e7edee55a..052fe3ef0 100644
--- a/test/Directory.Build.targets
+++ b/test/Directory.Build.targets
@@ -1,3 +1,3 @@
-
+
diff --git a/test/Nerdbank.GitVersioning.Benchmarks/GetVersionBenchmarks.cs b/test/Nerdbank.GitVersioning.Benchmarks/GetVersionBenchmarks.cs
index 214ab17b0..7a97daa88 100644
--- a/test/Nerdbank.GitVersioning.Benchmarks/GetVersionBenchmarks.cs
+++ b/test/Nerdbank.GitVersioning.Benchmarks/GetVersionBenchmarks.cs
@@ -9,9 +9,8 @@
namespace Nerdbank.GitVersioning.Benchmarks
{
- [SimpleJob(RuntimeMoniker.NetCoreApp31, baseline: true)]
- [SimpleJob(RuntimeMoniker.Net60)]
- [SimpleJob(RuntimeMoniker.Net461)]
+ [SimpleJob(RuntimeMoniker.Net70)]
+ [SimpleJob(RuntimeMoniker.Net462, baseline: true)]
public class GetVersionBenchmarks
{
// You must manually clone these repositories:
diff --git a/test/Nerdbank.GitVersioning.Benchmarks/Nerdbank.GitVersioning.Benchmarks.csproj b/test/Nerdbank.GitVersioning.Benchmarks/Nerdbank.GitVersioning.Benchmarks.csproj
index caef93e7c..6e0ed52af 100644
--- a/test/Nerdbank.GitVersioning.Benchmarks/Nerdbank.GitVersioning.Benchmarks.csproj
+++ b/test/Nerdbank.GitVersioning.Benchmarks/Nerdbank.GitVersioning.Benchmarks.csproj
@@ -1,19 +1,18 @@
- net6.0
+ net7.0
$(TargetFrameworks);net462
Exe
true
AnyCPU
false
- 0.13.2
-
-
-
+
+
+
diff --git a/test/Nerdbank.GitVersioning.Tests/MSBuildExtensions.cs b/test/Nerdbank.GitVersioning.Tests/MSBuildExtensions.cs
index 846795225..d77f7ba57 100644
--- a/test/Nerdbank.GitVersioning.Tests/MSBuildExtensions.cs
+++ b/test/Nerdbank.GitVersioning.Tests/MSBuildExtensions.cs
@@ -21,7 +21,20 @@ internal static void LoadMSBuild()
{
if (!loaded)
{
+#if NET
+ if (IntPtr.Size == 4)
+ {
+ // 32-bit .NET runtime requires special code to find the x86 SDK (where MSBuild is).
+ MSBuildLocator.RegisterMSBuildPath(@"C:\Program Files (x86)\dotnet\sdk\7.0.203");
+ }
+ else
+ {
+ MSBuildLocator.RegisterDefaults();
+ }
+#else
MSBuildLocator.RegisterDefaults();
+#endif
+
loaded = true;
}
}
diff --git a/test/Nerdbank.GitVersioning.Tests/Nerdbank.GitVersioning.Tests.csproj b/test/Nerdbank.GitVersioning.Tests/Nerdbank.GitVersioning.Tests.csproj
index 84bf12f8b..1dda283c2 100644
--- a/test/Nerdbank.GitVersioning.Tests/Nerdbank.GitVersioning.Tests.csproj
+++ b/test/Nerdbank.GitVersioning.Tests/Nerdbank.GitVersioning.Tests.csproj
@@ -1,13 +1,12 @@
- net6.0;net462
+ net7.0;net472
true
true
full
false
false
true
- 15.9.20
@@ -33,20 +32,20 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/tools/Install-DotNetSdk.ps1 b/tools/Install-DotNetSdk.ps1
index 2bac3b9bc..e190fcfbf 100755
--- a/tools/Install-DotNetSdk.ps1
+++ b/tools/Install-DotNetSdk.ps1
@@ -3,7 +3,7 @@
<#
.SYNOPSIS
Installs the .NET SDK specified in the global.json file at the root of this repository,
- along with supporting .NET Core runtimes used for testing.
+ along with supporting .NET runtimes used for testing.
.DESCRIPTION
This MAY not require elevation, as the SDK and runtimes are installed locally to this repo location,
unless `-InstallLocality machine` is specified.
@@ -15,14 +15,20 @@
When using 'repo', environment variables are set to cause the locally installed dotnet SDK to be used.
Per-repo can lead to file locking issues when dotnet.exe is left running as a build server and can be mitigated by running `dotnet build-server shutdown`.
Per-machine requires elevation and will download and install all SDKs and runtimes to machine-wide locations so all applications can find it.
+.PARAMETER SdkOnly
+ Skips installing the runtime.
.PARAMETER IncludeX86
Installs a x86 SDK and runtimes in addition to the x64 ones. Only supported on Windows. Ignored on others.
+.PARAMETER IncludeAspNetCore
+ Installs the ASP.NET Core runtime along with the .NET runtime.
#>
[CmdletBinding(SupportsShouldProcess=$true,ConfirmImpact='Medium')]
Param (
[ValidateSet('repo','user','machine')]
[string]$InstallLocality='user',
- [switch]$IncludeX86
+ [switch]$SdkOnly,
+ [switch]$IncludeX86,
+ [switch]$IncludeAspNetCore
)
$DotNetInstallScriptRoot = "$PSScriptRoot/../obj/tools"
@@ -41,39 +47,49 @@ $arch = [System.Runtime.InteropServices.RuntimeInformation]::ProcessArchitecture
if (!$arch) { # Windows Powershell leaves this blank
$arch = 'x64'
if ($env:PROCESSOR_ARCHITECTURE -eq 'ARM64') { $arch = 'ARM64' }
+ if (${env:ProgramFiles(Arm)}) { $arch = 'ARM64' }
}
-# Search for all .NET Core runtime versions referenced from MSBuild projects and arrange to install them.
+# Search for all .NET runtime versions referenced from MSBuild projects and arrange to install them.
$runtimeVersions = @()
$windowsDesktopRuntimeVersions = @()
-Get-ChildItem "$PSScriptRoot\..\src\*.*proj","$PSScriptRoot\..\test\*.*proj","$PSScriptRoot\..\Directory.Build.props" -Recurse |% {
- $projXml = [xml](Get-Content -Path $_)
- $pg = $projXml.Project.PropertyGroup
- if ($pg) {
- $targetFrameworks = @()
- $tf = $pg.TargetFramework
- $targetFrameworks += $tf
- $tfs = $pg.TargetFrameworks
- if ($tfs) {
- $targetFrameworks = $tfs -Split ';'
+$aspnetRuntimeVersions = @()
+if (!$SdkOnly) {
+ Get-ChildItem "$PSScriptRoot\..\src\*.*proj","$PSScriptRoot\..\test\*.*proj","$PSScriptRoot\..\Directory.Build.props" -Recurse |% {
+ $projXml = [xml](Get-Content -Path $_)
+ $pg = $projXml.Project.PropertyGroup
+ if ($pg) {
+ $targetFrameworks = @()
+ $tf = $pg.TargetFramework
+ $targetFrameworks += $tf
+ $tfs = $pg.TargetFrameworks
+ if ($tfs) {
+ $targetFrameworks = $tfs -Split ';'
+ }
}
- }
- $targetFrameworks |? { $_ -match 'net(?:coreapp)?(\d+\.\d+)' } |% {
- $v = $Matches[1]
- $runtimeVersions += $v
- if ($v -ge '3.0' -and -not ($IsMacOS -or $IsLinux)) {
- $windowsDesktopRuntimeVersions += $v
+ $targetFrameworks |? { $_ -match 'net(?:coreapp)?(\d+\.\d+)' } |% {
+ $v = $Matches[1]
+ $runtimeVersions += $v
+ $aspnetRuntimeVersions += $v
+ if ($v -ge '3.0' -and -not ($IsMacOS -or $IsLinux)) {
+ $windowsDesktopRuntimeVersions += $v
+ }
}
- }
- # Add target frameworks of the form: netXX
- $targetFrameworks |? { $_ -match 'net(\d+\.\d+)' } |% {
- $v = $Matches[1]
- $runtimeVersions += $v
- if (-not ($IsMacOS -or $IsLinux)) {
- $windowsDesktopRuntimeVersions += $v
+ # Add target frameworks of the form: netXX
+ $targetFrameworks |? { $_ -match 'net(\d+\.\d+)' } |% {
+ $v = $Matches[1]
+ $runtimeVersions += $v
+ $aspnetRuntimeVersions += $v
+ if (-not ($IsMacOS -or $IsLinux)) {
+ $windowsDesktopRuntimeVersions += $v
+ }
}
- }
+ }
+}
+
+if (!$IncludeAspNetCore) {
+ $aspnetRuntimeVersions = @()
}
Function Get-FileFromWeb([Uri]$Uri, $OutDir) {
@@ -98,7 +114,12 @@ Function Get-InstallerExe(
[string]$sku
) {
# Get the latest/actual version for the specified one
- $TypedVersion = [Version]$Version
+ $TypedVersion = $null
+ if (![Version]::TryParse($Version, [ref] $TypedVersion)) {
+ Write-Error "Unable to parse $Version into an a.b.c.d version. This version cannot be installed machine-wide."
+ exit 1
+ }
+
if ($TypedVersion.Build -eq -1) {
$versionInfo = -Split (Invoke-WebRequest -Uri "https://dotnetcli.blob.core.windows.net/dotnet/$sku/$Version/latest.version" -UseBasicParsing)
$Version = $versionInfo[-1]
@@ -117,6 +138,14 @@ Function Get-InstallerExe(
if ($release.$sku.version -eq $Version) {
$filesElement = $release.$sku.files
}
+ if (!$filesElement -and ($sku -eq 'sdk') -and $release.sdks) {
+ foreach ($sdk in $release.sdks) {
+ if ($sdk.version -eq $Version) {
+ $filesElement = $sdk.files
+ break
+ }
+ }
+ }
if ($filesElement) {
foreach ($file in $filesElement) {
@@ -135,14 +164,14 @@ Function Get-InstallerExe(
if ($url) {
Get-FileFromWeb -Uri $url -OutDir $DotNetInstallScriptRoot
} else {
- Write-Error "Unable to find release of $sku v$Version"
+ throw "Unable to find release of $sku v$Version"
}
}
-Function Install-DotNet($Version, $Architecture, [ValidateSet('Sdk','Runtime','WindowsDesktop')][string]$sku = 'Sdk') {
- Write-Host "Downloading .NET Core $sku $Version..."
+Function Install-DotNet($Version, $Architecture, [ValidateSet('Sdk','Runtime','WindowsDesktop','AspNetCore')][string]$sku = 'Sdk') {
+ Write-Host "Downloading .NET $sku $Version..."
$Installer = Get-InstallerExe -Version $Version -Architecture $Architecture -sku $sku
- Write-Host "Installing .NET Core $sku $Version..."
+ Write-Host "Installing .NET $sku $Version..."
cmd /c start /wait $Installer /install /passive /norestart
if ($LASTEXITCODE -eq 3010) {
Write-Verbose "Restart required"
@@ -196,6 +225,17 @@ if ($InstallLocality -eq 'machine') {
}
}
+ $aspnetRuntimeVersions | Sort-Object | Get-Unique |% {
+ if ($PSCmdlet.ShouldProcess("ASP.NET Core $_", "Install")) {
+ Install-DotNet -Version $_ -sku AspNetCore -Architecture $arch
+ $restartRequired = $restartRequired -or ($LASTEXITCODE -eq 3010)
+
+ if ($IncludeX86) {
+ Install-DotNet -Version $_ -sku AspNetCore -Architecture x86
+ $restartRequired = $restartRequired -or ($LASTEXITCODE -eq 3010)
+ }
+ }
+ }
if ($restartRequired) {
Write-Host -ForegroundColor Yellow "System restart required"
Exit 3010
@@ -234,10 +274,10 @@ if ($IncludeX86) {
}
if ($IsMacOS -or $IsLinux) {
- $DownloadUri = "https://raw.githubusercontent.com/dotnet/install-scripts/781752509a890ca7520f1182e8bae71f9a53d754/src/dotnet-install.sh"
+ $DownloadUri = "https://raw.githubusercontent.com/dotnet/install-scripts/0b09de9bc136cacb5f849a6957ebd4062173c148/src/dotnet-install.sh"
$DotNetInstallScriptPath = "$DotNetInstallScriptRoot/dotnet-install.sh"
} else {
- $DownloadUri = "https://raw.githubusercontent.com/dotnet/install-scripts/781752509a890ca7520f1182e8bae71f9a53d754/src/dotnet-install.ps1"
+ $DownloadUri = "https://raw.githubusercontent.com/dotnet/install-scripts/0b09de9bc136cacb5f849a6957ebd4062173c148/src/dotnet-install.ps1"
$DotNetInstallScriptPath = "$DotNetInstallScriptRoot/dotnet-install.ps1"
}
@@ -285,7 +325,7 @@ if ($IncludeX86) {
$dotnetRuntimeSwitches = $switches + '-Runtime','dotnet'
$runtimeVersions | Sort-Object -Unique |% {
- if ($PSCmdlet.ShouldProcess(".NET Core $Arch runtime $_", "Install")) {
+ if ($PSCmdlet.ShouldProcess(".NET $Arch runtime $_", "Install")) {
$anythingInstalled = $true
Invoke-Expression -Command "$DotNetInstallScriptPathExpression -Channel $_ -Architecture $arch -InstallDir $DotNetInstallDir $dotnetRuntimeSwitches"
@@ -298,7 +338,7 @@ $runtimeVersions | Sort-Object -Unique |% {
}
if ($IncludeX86) {
- if ($PSCmdlet.ShouldProcess(".NET Core x86 runtime $_", "Install")) {
+ if ($PSCmdlet.ShouldProcess(".NET x86 runtime $_", "Install")) {
$anythingInstalled = $true
Invoke-Expression -Command "$DotNetInstallScriptPathExpression -Channel $_ -Architecture x86 -InstallDir $DotNetX86InstallDir $dotnetRuntimeSwitches"
@@ -315,7 +355,7 @@ $runtimeVersions | Sort-Object -Unique |% {
$windowsDesktopRuntimeSwitches = $switches + '-Runtime','windowsdesktop'
$windowsDesktopRuntimeVersions | Sort-Object -Unique |% {
- if ($PSCmdlet.ShouldProcess(".NET Core WindowsDesktop $arch runtime $_", "Install")) {
+ if ($PSCmdlet.ShouldProcess(".NET WindowsDesktop $arch runtime $_", "Install")) {
$anythingInstalled = $true
Invoke-Expression -Command "$DotNetInstallScriptPathExpression -Channel $_ -Architecture $arch -InstallDir $DotNetInstallDir $windowsDesktopRuntimeSwitches"
@@ -328,7 +368,7 @@ $windowsDesktopRuntimeVersions | Sort-Object -Unique |% {
}
if ($IncludeX86) {
- if ($PSCmdlet.ShouldProcess(".NET Core WindowsDesktop x86 runtime $_", "Install")) {
+ if ($PSCmdlet.ShouldProcess(".NET WindowsDesktop x86 runtime $_", "Install")) {
$anythingInstalled = $true
Invoke-Expression -Command "$DotNetInstallScriptPathExpression -Channel $_ -Architecture x86 -InstallDir $DotNetX86InstallDir $windowsDesktopRuntimeSwitches"
@@ -342,10 +382,40 @@ $windowsDesktopRuntimeVersions | Sort-Object -Unique |% {
}
}
+$aspnetRuntimeSwitches = $switches + '-Runtime','aspnetcore'
+
+$aspnetRuntimeVersions | Sort-Object -Unique |% {
+ if ($PSCmdlet.ShouldProcess(".NET ASP.NET Core $arch runtime $_", "Install")) {
+ $anythingInstalled = $true
+ Invoke-Expression -Command "$DotNetInstallScriptPathExpression -Channel $_ -Architecture $arch -InstallDir $DotNetInstallDir $aspnetRuntimeSwitches"
+
+ if ($LASTEXITCODE -ne 0) {
+ Write-Error ".NET SDK installation failure: $LASTEXITCODE"
+ exit $LASTEXITCODE
+ }
+ } else {
+ Invoke-Expression -Command "$DotNetInstallScriptPathExpression -Channel $_ -Architecture $arch -InstallDir $DotNetInstallDir $aspnetRuntimeSwitches -DryRun"
+ }
+
+ if ($IncludeX86) {
+ if ($PSCmdlet.ShouldProcess(".NET ASP.NET Core x86 runtime $_", "Install")) {
+ $anythingInstalled = $true
+ Invoke-Expression -Command "$DotNetInstallScriptPathExpression -Channel $_ -Architecture x86 -InstallDir $DotNetX86InstallDir $aspnetRuntimeSwitches"
+
+ if ($LASTEXITCODE -ne 0) {
+ Write-Error ".NET SDK installation failure: $LASTEXITCODE"
+ exit $LASTEXITCODE
+ }
+ } else {
+ Invoke-Expression -Command "$DotNetInstallScriptPathExpression -Channel $_ -Architecture x86 -InstallDir $DotNetX86InstallDir $aspnetRuntimeSwitches -DryRun"
+ }
+ }
+}
+
if ($PSCmdlet.ShouldProcess("Set DOTNET environment variables to discover these installed runtimes?")) {
& "$PSScriptRoot/Set-EnvVars.ps1" -Variables $envVars -PrependPath $DotNetInstallDir | Out-Null
}
if ($anythingInstalled -and ($InstallLocality -ne 'machine') -and !$env:TF_BUILD -and !$env:GITHUB_ACTIONS) {
- Write-Warning ".NET Core runtimes or SDKs were installed to a non-machine location. Perform your builds or open Visual Studio from this same environment in order for tools to discover the location of these dependencies."
+ Write-Warning ".NET runtimes or SDKs were installed to a non-machine location. Perform your builds or open Visual Studio from this same environment in order for tools to discover the location of these dependencies."
}
diff --git a/version.json b/version.json
index 04420d359..f71e89462 100644
--- a/version.json
+++ b/version.json
@@ -10,6 +10,9 @@
"^refs/heads/v\\d+\\.\\d+$"
],
"cloudBuild": {
- "setVersionVariables": false
+ "setVersionVariables": false,
+ "buildNumber": {
+ "enabled": false
+ }
}
}