Skip to content

Commit f501224

Browse files
author
vp
committed
Add update-packages task to automate package updates using dotnet-outdated
1 parent 6de4bfd commit f501224

4 files changed

Lines changed: 17 additions & 4 deletions

File tree

.vscode/tasks-dotnet.ps1

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,17 @@ switch ($Command.ToLowerInvariant()) {
8888
$pkgs | ConvertTo-Json -Depth 4 | Set-Content -Path $outFile -Encoding UTF8
8989
Write-Host ("Outdated packages captured: {0}" -f $pkgs.Count) -ForegroundColor Green
9090
}
91+
'update-packages' {
92+
# Use dotnet-outdated global tool to update central package versions.
93+
Write-Host 'Ensuring dotnet-outdated tool is installed...' -ForegroundColor DarkGray
94+
$toolInfo = & dotnet tool list -g | Out-String
95+
if($toolInfo -notmatch 'dotnet-outdated'){ & dotnet tool install --global dotnet-outdated-tool }
96+
Write-Host 'Running dotnet-outdated (auto upgrade within constraints)...' -ForegroundColor Cyan
97+
# Central Package Management: dotnet-outdated supports --upgrade and --allow-major-version-updates if desired.
98+
& dotnet outdated $SolutionPath --upgrade
99+
if($LASTEXITCODE -ne 0){ Write-Host 'dotnet-outdated reported issues or applied updates with non-zero exit code.' -ForegroundColor Yellow }
100+
Write-Host 'dotnet-outdated execution complete.' -ForegroundColor Green
101+
}
91102
'analyzers' { Invoke-Dotnet @('build',$SolutionPath,'-warnaserror','/p:RunAnalyzers=true','/p:EnableNETAnalyzers=true','/p:AnalysisLevel=latest') }
92103
'project-build' { if (-not $ProjectPath) { throw 'ProjectPath required for project-build' }; Invoke-Dotnet (@('build',$ProjectPath) + $logArgs) }
93104
'project-publish' {

.vscode/tasks.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
{ "label": "Solution [build no-restore]", "type": "shell", "command": "pwsh", "args": ["-NoProfile","-File","${workspaceFolder}/tasks.ps1","-Task","build-nr"], "group": {"kind":"build"}, "problemMatcher": [] },
77
{ "label": "Solution [pack]", "type": "shell", "command": "pwsh", "args": ["-NoProfile","-File","${workspaceFolder}/tasks.ps1","-Task","pack"], "group": {"kind":"build"}, "problemMatcher": [] },
88
{ "label": "Solution [pack modules]", "type": "shell", "command": "pwsh", "args": ["-NoProfile","-File","${workspaceFolder}/tasks.ps1","-Task","pack-modules"], "group": {"kind":"build"}, "problemMatcher": [] },
9+
{ "label": "Solution [update packages]", "type": "shell", "command": "pwsh", "args": ["-NoProfile","-File","${workspaceFolder}/tasks.ps1","-Task","update-packages"], "group": {"kind":"build"}, "problemMatcher": [] },
910
{ "label": "Solution [restore]", "type": "shell", "command": "pwsh", "args": ["-NoProfile","-File","${workspaceFolder}/tasks.ps1","-Task","restore"], "group": {"kind":"build"}, "problemMatcher": [] },
1011
{ "label": "Solution [clean]", "type": "shell", "command": "pwsh", "args": ["-NoProfile","-File","${workspaceFolder}/tasks.ps1","-Task","clean"], "group": {"kind":"build"}, "problemMatcher": [] },
1112
{ "label": "Solution [tool restore]", "type": "shell", "command": "pwsh", "args": ["-NoProfile","-File","${workspaceFolder}/tasks.ps1","-Task","tool-restore"], "problemMatcher": [] },

Directory.Packages.props

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<CentralPackageTransitivePinningEnabled>false</CentralPackageTransitivePinningEnabled>
55
</PropertyGroup>
66
<ItemGroup>
7-
<PackageVersion Include="BenchmarkDotNet" Version="0.15.2" />
7+
<PackageVersion Include="BenchmarkDotNet" Version="0.15.4" />
88
<PackageVersion Include="BridgingIT.DevKit.Application.JobScheduling" Version="9.0.26-preview.0.7" />
99
<PackageVersion Include="BridgingIT.DevKit.Common.Mapping" Version="9.0.26-preview.0.7" />
1010
<PackageVersion Include="BridgingIT.DevKit.Common.Utilities.Xunit" Version="9.0.26-preview.0.7" />
@@ -28,7 +28,7 @@
2828
<PackageVersion Include="Microsoft.Extensions.Diagnostics.HealthChecks" Version="9.0.10" />
2929
<PackageVersion Include="Microsoft.Extensions.TimeProvider.Testing" Version="9.10.0" />
3030
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="18.0.0" />
31-
<PackageVersion Include="Microsoft.VisualStudio.DiagnosticsHub.BenchmarkDotNetDiagnosers" Version="18.0.36313.1" />
31+
<PackageVersion Include="Microsoft.VisualStudio.DiagnosticsHub.BenchmarkDotNetDiagnosers" Version="18.0.36525.3" />
3232
<PackageVersion Include="NetArchTest.eNhancedEdition" Version="1.4.5" />
3333
<PackageVersion Include="NSubstitute" Version="5.3.0" />
3434
<PackageVersion Include="OpenTelemetry.Exporter.OpenTelemetryProtocol" Version="1.13.1" />
@@ -48,6 +48,6 @@
4848
<PrivateAssets>all</PrivateAssets>
4949
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
5050
</PackageVersion>
51-
<PackageVersion Include="Quartz.Serialization.Json" Version="3.15.0" />
51+
<PackageVersion Include="Quartz.Serialization.Json" Version="3.15.1" />
5252
</ItemGroup>
5353
</Project>

tasks.ps1

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,7 @@ $tasks = [ordered]@{
122122
'server-run-dev' = @{ Label='Server Project Run Dev'; Script={ Invoke-DotnetScript 'project-run' (Join-Path $PSScriptRoot 'src/Presentation.Web.Server/Presentation.Web.Server.csproj') } }
123123
'server-watch-fast' = @{ Label='Server Project Watch Fast'; Script={ Invoke-DotnetScript 'project-watch-fast' (Join-Path $PSScriptRoot 'src/Presentation.Web.Server/Presentation.Web.Server.csproj') } }
124124
'pack-modules' = @{ Label='Pack Modules (Release)'; Script={ Invoke-DotnetScript 'pack-modules' } }
125+
'update-packages' = @{ Label='Update Outdated Packages (Central)' ; Script={ Invoke-DotnetScript 'update-packages' } }
125126
'openapi-lint' = @{ Label='OpenAPI Lint'; Script={ Invoke-OpenApiLint } }
126127
'misc-clean' = @{ Label='Misc Clean Workspace'; Script={ Invoke-Misc 'clean' } }
127128
'misc-digest' = @{ Label='Misc Digest Sources'; Script={ Invoke-Misc 'digest' } }
@@ -142,7 +143,7 @@ $tasks = [ordered]@{
142143
}
143144

144145
$categories = [ordered]@{
145-
'Build & Maintenance' = @('restore','build','build-release','build-nr','pack','pack-modules','clean','tool-restore','format-check','format-apply','analyzers','analyzers-export','server-build','server-publish','server-publish-release','server-publish-sc','server-watch','server-run-dev','server-watch-fast')
146+
'Build & Maintenance' = @('restore','build','build-release','build-nr','pack','pack-modules','update-packages','clean','tool-restore','format-check','format-apply','analyzers','analyzers-export','server-build','server-publish','server-publish-release','server-publish-sc','server-watch','server-run-dev','server-watch-fast')
146147
'Testing & Quality' = @('test-unit','test-int','test-unit-all','test-int-all','coverage','coverage-html','coverage-open','coverage-all-html')
147148
'EF & Persistence' = @('ef-info','ef-list','ef-add','ef-remove','ef-removeall','ef-apply','ef-update','ef-recreate','ef-undo','ef-status','ef-reset','ef-script')
148149
'Publishing & Packaging' = @('server-publish','server-publish-release','server-publish-sc','pack','pack-modules')

0 commit comments

Comments
 (0)