diff --git a/.github/actions/spelling/expect.txt b/.github/actions/spelling/expect.txt
index 2e41a48dcf..0cfbb70317 100644
--- a/.github/actions/spelling/expect.txt
+++ b/.github/actions/spelling/expect.txt
@@ -46,6 +46,7 @@ auxdata
awgpm
awgs
azurewebsites
+bak
Baz
bbb
bcp
@@ -605,7 +606,7 @@ website
wesome
wfsopen
wgetenv
-Whatif
+whatif
WIC
wildcards
WINAPI
diff --git a/src/AppInstallerCLI.sln b/src/AppInstallerCLI.sln
index d9632733c8..60fa85ad3d 100644
--- a/src/AppInstallerCLI.sln
+++ b/src/AppInstallerCLI.sln
@@ -38,9 +38,11 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Project", "Project", "{8D53
..\azure-pipelines.yml = ..\azure-pipelines.yml
..\cgmanifest.json = ..\cgmanifest.json
Directory.Build.props = Directory.Build.props
+ Get-VcxprojNugetPackageVersions.ps1 = Get-VcxprojNugetPackageVersions.ps1
..\README.md = ..\README.md
..\doc\ReleaseNotes.md = ..\doc\ReleaseNotes.md
..\doc\Settings.md = ..\doc\Settings.md
+ Update-VcxprojNugetPackageVersions.ps1 = Update-VcxprojNugetPackageVersions.ps1
..\WinGetInProcCom.nuspec = ..\WinGetInProcCom.nuspec
..\WinGetUtil.nuspec = ..\WinGetUtil.nuspec
EndProjectSection
diff --git a/src/AppInstallerCLI/AppInstallerCLI.vcxproj b/src/AppInstallerCLI/AppInstallerCLI.vcxproj
index 6828ce046a..3c0a66d853 100644
--- a/src/AppInstallerCLI/AppInstallerCLI.vcxproj
+++ b/src/AppInstallerCLI/AppInstallerCLI.vcxproj
@@ -1,6 +1,6 @@
-
+
true
true
@@ -252,13 +252,13 @@
-
+
This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.
-
-
+
+
-
\ No newline at end of file
+
diff --git a/src/AppInstallerCLI/packages.config b/src/AppInstallerCLI/packages.config
index 020eb5a81b..f229371b33 100644
--- a/src/AppInstallerCLI/packages.config
+++ b/src/AppInstallerCLI/packages.config
@@ -1,4 +1,4 @@
-
+
\ No newline at end of file
diff --git a/src/AppInstallerCLICore/AppInstallerCLICore.vcxproj b/src/AppInstallerCLICore/AppInstallerCLICore.vcxproj
index ffdbf0d4ff..4bad3ac624 100644
--- a/src/AppInstallerCLICore/AppInstallerCLICore.vcxproj
+++ b/src/AppInstallerCLICore/AppInstallerCLICore.vcxproj
@@ -1,6 +1,6 @@
-
+
true
true
@@ -482,15 +482,16 @@
-
-
+
+
This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.
-
-
-
+
+
+
-
\ No newline at end of file
+
+
diff --git a/src/AppInstallerCLICore/packages.config b/src/AppInstallerCLICore/packages.config
index 7aa172914d..f7979cb735 100644
--- a/src/AppInstallerCLICore/packages.config
+++ b/src/AppInstallerCLICore/packages.config
@@ -1,5 +1,5 @@
-
-
+
+
\ No newline at end of file
diff --git a/src/AppInstallerCLICore/pch.h b/src/AppInstallerCLICore/pch.h
index e13f7ed751..0d10bef71f 100644
--- a/src/AppInstallerCLICore/pch.h
+++ b/src/AppInstallerCLICore/pch.h
@@ -49,12 +49,13 @@
#include
#pragma warning( push )
-#pragma warning ( disable : 6001 6285 6340 6388 )
+#pragma warning ( disable : 6001 6285 6340 6388 26451 )
#include
#include
#include
#include
#include
+#include
#pragma warning( pop )
#include
diff --git a/src/AppInstallerCLITests/AppInstallerCLITests.vcxproj b/src/AppInstallerCLITests/AppInstallerCLITests.vcxproj
index 7bbd210747..7bfb21c66c 100644
--- a/src/AppInstallerCLITests/AppInstallerCLITests.vcxproj
+++ b/src/AppInstallerCLITests/AppInstallerCLITests.vcxproj
@@ -1,6 +1,6 @@
-
+
true
true
@@ -1073,15 +1073,16 @@
-
-
+
+
This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.
-
-
-
+
+
+
-
\ No newline at end of file
+
+
diff --git a/src/AppInstallerCLITests/packages.config b/src/AppInstallerCLITests/packages.config
index 7aa172914d..f7979cb735 100644
--- a/src/AppInstallerCLITests/packages.config
+++ b/src/AppInstallerCLITests/packages.config
@@ -1,5 +1,5 @@
-
-
+
+
\ No newline at end of file
diff --git a/src/AppInstallerCommonCore/AppInstallerCommonCore.vcxproj b/src/AppInstallerCommonCore/AppInstallerCommonCore.vcxproj
index 3a1b82b7b3..c1c3148722 100644
--- a/src/AppInstallerCommonCore/AppInstallerCommonCore.vcxproj
+++ b/src/AppInstallerCommonCore/AppInstallerCommonCore.vcxproj
@@ -1,6 +1,6 @@
-
+
true
true
@@ -469,15 +469,17 @@
-
-
+
+
This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.
-
-
-
+
+
+
+
+
diff --git a/src/AppInstallerCommonCore/packages.config b/src/AppInstallerCommonCore/packages.config
index 7aa172914d..f7979cb735 100644
--- a/src/AppInstallerCommonCore/packages.config
+++ b/src/AppInstallerCommonCore/packages.config
@@ -1,5 +1,5 @@
-
-
+
+
\ No newline at end of file
diff --git a/src/AppInstallerCommonCore/pch.h b/src/AppInstallerCommonCore/pch.h
index bf28a8c0c6..365fea37af 100644
--- a/src/AppInstallerCommonCore/pch.h
+++ b/src/AppInstallerCommonCore/pch.h
@@ -80,6 +80,7 @@
#include
#include
#include
+#include
#pragma warning( pop )
#include
diff --git a/src/AppInstallerRepositoryCore/AppInstallerRepositoryCore.vcxproj b/src/AppInstallerRepositoryCore/AppInstallerRepositoryCore.vcxproj
index 8744d0ab91..292a62cc55 100644
--- a/src/AppInstallerRepositoryCore/AppInstallerRepositoryCore.vcxproj
+++ b/src/AppInstallerRepositoryCore/AppInstallerRepositoryCore.vcxproj
@@ -1,6 +1,6 @@
-
+
true
true
@@ -512,15 +512,16 @@
-
-
+
+
This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.
-
-
-
+
+
+
-
\ No newline at end of file
+
+
diff --git a/src/AppInstallerRepositoryCore/packages.config b/src/AppInstallerRepositoryCore/packages.config
index 7aa172914d..f7979cb735 100644
--- a/src/AppInstallerRepositoryCore/packages.config
+++ b/src/AppInstallerRepositoryCore/packages.config
@@ -1,5 +1,5 @@
-
-
+
+
\ No newline at end of file
diff --git a/src/AppInstallerRepositoryCore/pch.h b/src/AppInstallerRepositoryCore/pch.h
index 1fe0660b64..a0a55ee61d 100644
--- a/src/AppInstallerRepositoryCore/pch.h
+++ b/src/AppInstallerRepositoryCore/pch.h
@@ -11,12 +11,13 @@
#include
#pragma warning( push )
-#pragma warning ( disable : 6001 6340 6387 6388 26495 28196 )
+#pragma warning ( disable : 6001 6340 6387 6388 26451 26495 28196 )
#include
#include
#include
#include
-#include
+#include
+#include
#pragma warning( pop )
#include
diff --git a/src/AppInstallerSharedLib/AppInstallerSharedLib.vcxproj b/src/AppInstallerSharedLib/AppInstallerSharedLib.vcxproj
index 511de1d87b..2114fa4095 100644
--- a/src/AppInstallerSharedLib/AppInstallerSharedLib.vcxproj
+++ b/src/AppInstallerSharedLib/AppInstallerSharedLib.vcxproj
@@ -1,6 +1,6 @@
-
+
-
+
true
true
@@ -414,15 +414,16 @@
-
-
+
+
This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.
-
-
-
+
+
+
-
\ No newline at end of file
+
+
diff --git a/src/AppInstallerSharedLib/packages.config b/src/AppInstallerSharedLib/packages.config
index 7aa172914d..f7979cb735 100644
--- a/src/AppInstallerSharedLib/packages.config
+++ b/src/AppInstallerSharedLib/packages.config
@@ -1,5 +1,5 @@
-
-
+
+
\ No newline at end of file
diff --git a/src/Get-VcxprojNugetPackageVersions.ps1 b/src/Get-VcxprojNugetPackageVersions.ps1
new file mode 100644
index 0000000000..04c4958650
--- /dev/null
+++ b/src/Get-VcxprojNugetPackageVersions.ps1
@@ -0,0 +1,339 @@
+#Requires -Version 5.1
+
+<#
+.SYNOPSIS
+ Recursively searches for .vcxproj files and extracts NuGet package versions from associated packages.config files.
+
+.DESCRIPTION
+ This script searches directories below the script location for Visual Studio C++ project files (.vcxproj)
+ and their corresponding packages.config files. It extracts all NuGet package references with their versions
+ and generates a comprehensive report.
+
+.PARAMETER OutputFormat
+ Specifies the output format: Table, CSV, JSON, or Object. Default is Table. Object format returns PackageInfo objects without printing anything.
+
+.PARAMETER ExportPath
+ Optional path to export the results to a file. Not applicable for Object format.
+
+.PARAMETER PackageFilter
+ Optional filter to search for specific package names. Supports wildcards. If specified, only packages matching this filter will be included in the results.
+
+.EXAMPLE
+ .\Get-VcxprojNugetPackageVersions.ps1
+
+.EXAMPLE
+ .\Get-VcxprojNugetPackageVersions.ps1 -OutputFormat CSV -ExportPath "packages-report.csv"
+
+.EXAMPLE
+ .\Get-VcxprojNugetPackageVersions.ps1 -PackageFilter "Microsoft*"
+
+.EXAMPLE
+ .\Get-VcxprojNugetPackageVersions.ps1 -PackageFilter "Newtonsoft.Json" -OutputFormat JSON
+
+.EXAMPLE
+ $packages = .\Get-VcxprojNugetPackageVersions.ps1 -OutputFormat Object
+#>
+
+[CmdletBinding()]
+param(
+ [ValidateSet("Table", "CSV", "JSON", "Object")]
+ [string]$OutputFormat = "Table",
+
+ [string]$ExportPath,
+
+ [string]$PackageFilter
+)
+
+# Custom class to hold package information
+class PackageInfo {
+ [string]$ProjectFile
+ [string]$ProjectName
+ [string]$PackageId
+ [string]$Version
+ [string]$TargetFramework
+ [string]$PackagesConfigPath
+ [bool]$PackagesConfigExists
+}
+
+function Get-VcxprojFiles {
+ param(
+ [string]$SearchPath,
+ [bool]$SuppressOutput = $false
+ )
+
+ Write-Verbose "Searching for .vcxproj files in: $SearchPath"
+
+ try {
+ $vcxprojFiles = Get-ChildItem -Path $SearchPath -Filter "*.vcxproj" -Recurse -ErrorAction SilentlyContinue
+ if (-not $SuppressOutput) {
+ Write-Host "Found $($vcxprojFiles.Count) .vcxproj files" -ForegroundColor Green
+ }
+ return $vcxprojFiles
+ }
+ catch {
+ Write-Warning "Error searching for .vcxproj files: $($_.Exception.Message)"
+ return @()
+ }
+}
+
+function Get-PackagesFromConfig {
+ param(
+ [string]$PackagesConfigPath,
+ [string]$ProjectFile,
+ [string]$ProjectName,
+ [string]$PackageFilter
+ )
+
+ $packages = @()
+
+ if (-not (Test-Path $PackagesConfigPath)) {
+ Write-Verbose "No packages.config found for project: $ProjectName"
+
+ # If a package filter is specified and there's no packages.config, don't include this project
+ if ($PackageFilter) {
+ Write-Verbose "Package filter specified but no packages.config exists for project: $ProjectName. Excluding from results."
+ return @()
+ }
+
+ # Return empty package info to indicate no packages.config
+ $packageInfo = [PackageInfo]::new()
+ $packageInfo.ProjectFile = $ProjectFile
+ $packageInfo.ProjectName = $ProjectName
+ $packageInfo.PackageId = "N/A"
+ $packageInfo.Version = "N/A"
+ $packageInfo.TargetFramework = "N/A"
+ $packageInfo.PackagesConfigPath = $PackagesConfigPath
+ $packageInfo.PackagesConfigExists = $false
+ return @($packageInfo)
+ }
+
+ try {
+ Write-Verbose "Processing packages.config: $PackagesConfigPath"
+ [xml]$packagesXml = Get-Content $PackagesConfigPath -ErrorAction Stop
+
+ $packageNodes = $packagesXml.packages.package
+
+ if ($null -eq $packageNodes) {
+ Write-Verbose "No package nodes found in packages.config for project: $ProjectName"
+ return @()
+ }
+
+ # Handle both single package and multiple packages scenarios
+ if ($packageNodes -is [System.Xml.XmlElement]) {
+ # Single package
+ $packageNodes = @($packageNodes)
+ }
+
+ foreach ($package in $packageNodes) {
+ # Apply package filter if specified
+ if ($PackageFilter -and $package.id -notlike $PackageFilter) {
+ Write-Verbose "Package '$($package.id)' does not match filter '$PackageFilter', skipping"
+ continue
+ }
+
+ $packageInfo = [PackageInfo]::new()
+ $packageInfo.ProjectFile = $ProjectFile
+ $packageInfo.ProjectName = $ProjectName
+ $packageInfo.PackageId = $package.id
+ $packageInfo.Version = $package.version
+ $packageInfo.TargetFramework = $package.targetFramework
+ $packageInfo.PackagesConfigPath = $PackagesConfigPath
+ $packageInfo.PackagesConfigExists = $true
+
+ $packages += $packageInfo
+ }
+
+ Write-Verbose "Found $($packages.Count) packages in $ProjectName"
+ }
+ catch {
+ Write-Warning "Error parsing packages.config for project '$ProjectName': $($_.Exception.Message)"
+ }
+
+ return $packages
+}
+
+function Get-ProjectName {
+ param([string]$VcxprojPath)
+
+ try {
+ [xml]$projectXml = Get-Content $VcxprojPath -ErrorAction Stop
+
+ # Try to get project name from PropertyGroup
+ $projectNameNode = $projectXml.Project.PropertyGroup.ProjectName | Select-Object -First 1
+ if ($projectNameNode) {
+ return $projectNameNode
+ }
+
+ # Fallback to filename without extension
+ return [System.IO.Path]::GetFileNameWithoutExtension($VcxprojPath)
+ }
+ catch {
+ Write-Verbose "Could not parse project file for name, using filename: $($_.Exception.Message)"
+ return [System.IO.Path]::GetFileNameWithoutExtension($VcxprojPath)
+ }
+}
+
+function Export-Results {
+ param(
+ [array]$Results,
+ [string]$Format,
+ [string]$Path
+ )
+
+ if (-not $Path) {
+ return
+ }
+
+ try {
+ switch ($Format) {
+ "CSV" {
+ $Results | Export-Csv -Path $Path -NoTypeInformation
+ Write-Host "Results exported to CSV: $Path" -ForegroundColor Green
+ }
+ "JSON" {
+ $Results | ConvertTo-Json -Depth 3 | Out-File -FilePath $Path -Encoding utf8
+ Write-Host "Results exported to JSON: $Path" -ForegroundColor Green
+ }
+ default {
+ $Results | Format-Table -AutoSize | Out-File -FilePath $Path -Encoding utf8
+ Write-Host "Results exported to text file: $Path" -ForegroundColor Green
+ }
+ }
+ }
+ catch {
+ Write-Warning "Failed to export results to '$Path': $($_.Exception.Message)"
+ }
+}
+
+function Show-Summary {
+ param([array]$AllPackages)
+
+ $projectsWithPackages = $AllPackages | Where-Object { $_.PackagesConfigExists } | Group-Object ProjectFile
+ $projectsWithoutPackages = $AllPackages | Where-Object { -not $_.PackagesConfigExists } | Group-Object ProjectFile
+
+ Write-Host "`n=== SUMMARY ===" -ForegroundColor Cyan
+ Write-Host "Total .vcxproj files found: $($projectsWithPackages.Count + $projectsWithoutPackages.Count)"
+ Write-Host "Projects with packages.config: $($projectsWithPackages.Count)" -ForegroundColor Green
+ Write-Host "Projects without packages.config: $($projectsWithoutPackages.Count)" -ForegroundColor Yellow
+ Write-Host "Total package references: $(($AllPackages | Where-Object { $_.PackagesConfigExists }).Count)" -ForegroundColor Green
+}
+
+# Main execution
+try {
+ $scriptPath = Split-Path -Parent $MyInvocation.MyCommand.Path
+
+ # Suppress output messages for Object format
+ if ($OutputFormat -ne "Object") {
+ Write-Host "Starting search from: $scriptPath" -ForegroundColor Cyan
+ Write-Host "Output format: $OutputFormat" -ForegroundColor Cyan
+
+ if ($PackageFilter) {
+ Write-Host "Package filter: $PackageFilter" -ForegroundColor Cyan
+ }
+
+ if ($ExportPath) {
+ Write-Host "Export path: $ExportPath" -ForegroundColor Cyan
+ }
+ }
+
+ # Find all .vcxproj files
+ $vcxprojFiles = Get-VcxprojFiles -SearchPath $scriptPath -SuppressOutput ($OutputFormat -eq "Object")
+
+ if ($vcxprojFiles.Count -eq 0) {
+ if ($OutputFormat -ne "Object") {
+ Write-Warning "No .vcxproj files found in the search directory."
+ }
+ return @() # Return empty array for Object format
+ }
+
+ # Process each .vcxproj file
+ $allPackages = @()
+ $processedCount = 0
+
+ foreach ($vcxproj in $vcxprojFiles) {
+ $processedCount++
+ Write-Progress -Activity "Processing .vcxproj files" -Status "$processedCount of $($vcxprojFiles.Count)" -PercentComplete (($processedCount / $vcxprojFiles.Count) * 100)
+
+ $projectName = Get-ProjectName -VcxprojPath $vcxproj.FullName
+ $packagesConfigPath = Join-Path $vcxproj.DirectoryName "packages.config"
+
+ $packages = Get-PackagesFromConfig -PackagesConfigPath $packagesConfigPath -ProjectFile $vcxproj.FullName -ProjectName $projectName -PackageFilter $PackageFilter
+ $allPackages += $packages
+ }
+
+ Write-Progress -Activity "Processing .vcxproj files" -Completed
+
+ # Display results
+ if ($allPackages.Count -gt 0) {
+ switch ($OutputFormat) {
+ "CSV" {
+ if ($ExportPath) {
+ Export-Results -Results $allPackages -Format "CSV" -Path $ExportPath
+ } else {
+ $allPackages | ConvertTo-Csv -NoTypeInformation | Write-Output
+ }
+ }
+ "JSON" {
+ if ($ExportPath) {
+ Export-Results -Results $allPackages -Format "JSON" -Path $ExportPath
+ } else {
+ $allPackages | ConvertTo-Json -Depth 3 | Write-Output
+ }
+ }
+ "Object" {
+ # Return only packages where PackagesConfigExists is true
+ $packagesWithConfig = $allPackages | Where-Object { $_.PackagesConfigExists }
+ return $packagesWithConfig
+ }
+ default {
+ # Table format
+ Write-Host "`n=== PACKAGE DETAILS ===" -ForegroundColor Cyan
+
+ # Show the set of packages and versions found across all projects
+ $uniquePackages = $allPackages | Where-Object { $_.PackagesConfigExists } | Group-Object PackageId, Version
+ if ($uniquePackages.Count -gt 0) {
+ $uniquePackages | Format-Table -Property Name, Count -AutoSize
+ }
+
+ # Output the URL of each package on nuget.org
+ Write-Host "`n=== PACKAGE URLS ===" -ForegroundColor Cyan
+
+ $uniquePackages = $allPackages | Where-Object { $_.PackagesConfigExists } | Group-Object PackageId
+ foreach ($packageGroup in $uniquePackages) {
+ $packageId = $packageGroup.Name
+ $url = "https://www.nuget.org/packages/$packageId#versions-body-tab"
+ Write-Host " $packageId : $url" -ForegroundColor Yellow
+ }
+
+ Write-Host "`n=== PROJECT DETAILS ===" -ForegroundColor Cyan
+
+ # Show projects with packages
+ $packagesWithConfig = $allPackages | Where-Object { $_.PackagesConfigExists }
+ if ($packagesWithConfig.Count -gt 0) {
+ $packagesWithConfig | Format-Table -Property ProjectName, PackageId, Version, TargetFramework -AutoSize
+ }
+
+ if ($ExportPath) {
+ Export-Results -Results $allPackages -Format $OutputFormat -Path $ExportPath
+ }
+ }
+ }
+
+ # Show summary (but not for Object format)
+ if ($OutputFormat -ne "Object") {
+ Show-Summary -AllPackages $allPackages
+ }
+ } else {
+ if ($OutputFormat -ne "Object") {
+ Write-Host "No packages found in any .vcxproj files." -ForegroundColor Yellow
+ }
+ }
+}
+catch {
+ Write-Error "An error occurred during execution: $($_.Exception.Message)"
+ Write-Error $_.ScriptStackTrace
+}
+
+if ($OutputFormat -ne "Object") {
+ Write-Host "`nScript completed." -ForegroundColor Green
+}
\ No newline at end of file
diff --git a/src/Microsoft.Management.Configuration.OutOfProc/Microsoft.Management.Configuration.OutOfProc.vcxproj b/src/Microsoft.Management.Configuration.OutOfProc/Microsoft.Management.Configuration.OutOfProc.vcxproj
index 33a428da66..9bc823d352 100644
--- a/src/Microsoft.Management.Configuration.OutOfProc/Microsoft.Management.Configuration.OutOfProc.vcxproj
+++ b/src/Microsoft.Management.Configuration.OutOfProc/Microsoft.Management.Configuration.OutOfProc.vcxproj
@@ -1,6 +1,6 @@
-
+
true
true
@@ -417,15 +417,16 @@
-
-
+
+
This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.
-
-
-
+
+
+
-
\ No newline at end of file
+
+
diff --git a/src/Microsoft.Management.Configuration.OutOfProc/packages.config b/src/Microsoft.Management.Configuration.OutOfProc/packages.config
index 7aa172914d..f7979cb735 100644
--- a/src/Microsoft.Management.Configuration.OutOfProc/packages.config
+++ b/src/Microsoft.Management.Configuration.OutOfProc/packages.config
@@ -1,5 +1,5 @@
-
-
+
+
\ No newline at end of file
diff --git a/src/Microsoft.Management.Configuration/Microsoft.Management.Configuration.vcxproj b/src/Microsoft.Management.Configuration/Microsoft.Management.Configuration.vcxproj
index 943881aed8..efd15d93c9 100644
--- a/src/Microsoft.Management.Configuration/Microsoft.Management.Configuration.vcxproj
+++ b/src/Microsoft.Management.Configuration/Microsoft.Management.Configuration.vcxproj
@@ -1,6 +1,6 @@
-
+
true
true
@@ -318,15 +318,16 @@
-
-
+
+
This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.
-
-
-
+
+
+
-
\ No newline at end of file
+
+
diff --git a/src/Microsoft.Management.Configuration/packages.config b/src/Microsoft.Management.Configuration/packages.config
index 7aa172914d..f7979cb735 100644
--- a/src/Microsoft.Management.Configuration/packages.config
+++ b/src/Microsoft.Management.Configuration/packages.config
@@ -1,5 +1,5 @@
-
-
+
+
\ No newline at end of file
diff --git a/src/Microsoft.Management.Deployment.InProc/Microsoft.Management.Deployment.InProc.vcxproj b/src/Microsoft.Management.Deployment.InProc/Microsoft.Management.Deployment.InProc.vcxproj
index bcf1f98477..cb11ed52d6 100644
--- a/src/Microsoft.Management.Deployment.InProc/Microsoft.Management.Deployment.InProc.vcxproj
+++ b/src/Microsoft.Management.Deployment.InProc/Microsoft.Management.Deployment.InProc.vcxproj
@@ -1,6 +1,6 @@
-
+
true
true
@@ -374,19 +374,20 @@
-
-
+
+
This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.
-
-
-
+
+
+
-
\ No newline at end of file
+
+
diff --git a/src/Microsoft.Management.Deployment.InProc/packages.config b/src/Microsoft.Management.Deployment.InProc/packages.config
index 7aa172914d..f7979cb735 100644
--- a/src/Microsoft.Management.Deployment.InProc/packages.config
+++ b/src/Microsoft.Management.Deployment.InProc/packages.config
@@ -1,5 +1,5 @@
-
-
+
+
\ No newline at end of file
diff --git a/src/Microsoft.Management.Deployment.OutOfProc/Microsoft.Management.Deployment.OutOfProc.vcxproj b/src/Microsoft.Management.Deployment.OutOfProc/Microsoft.Management.Deployment.OutOfProc.vcxproj
index 4bdb37afd0..f06cdf8c78 100644
--- a/src/Microsoft.Management.Deployment.OutOfProc/Microsoft.Management.Deployment.OutOfProc.vcxproj
+++ b/src/Microsoft.Management.Deployment.OutOfProc/Microsoft.Management.Deployment.OutOfProc.vcxproj
@@ -1,6 +1,6 @@
-
+
true
true
@@ -415,15 +415,16 @@
-
-
+
+
This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.
-
-
-
+
+
+
-
\ No newline at end of file
+
+
diff --git a/src/Microsoft.Management.Deployment.OutOfProc/packages.config b/src/Microsoft.Management.Deployment.OutOfProc/packages.config
index 7aa172914d..f7979cb735 100644
--- a/src/Microsoft.Management.Deployment.OutOfProc/packages.config
+++ b/src/Microsoft.Management.Deployment.OutOfProc/packages.config
@@ -1,5 +1,5 @@
-
-
+
+
\ No newline at end of file
diff --git a/src/Microsoft.Management.Deployment/Microsoft.Management.Deployment.vcxproj b/src/Microsoft.Management.Deployment/Microsoft.Management.Deployment.vcxproj
index 8a453f9ecd..d3d10deda9 100644
--- a/src/Microsoft.Management.Deployment/Microsoft.Management.Deployment.vcxproj
+++ b/src/Microsoft.Management.Deployment/Microsoft.Management.Deployment.vcxproj
@@ -1,6 +1,6 @@
-
+
-
+
true
true
@@ -269,15 +269,16 @@
-
-
+
+
This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.
-
-
-
+
+
+
-
\ No newline at end of file
+
+
diff --git a/src/Microsoft.Management.Deployment/packages.config b/src/Microsoft.Management.Deployment/packages.config
index 7aa172914d..f7979cb735 100644
--- a/src/Microsoft.Management.Deployment/packages.config
+++ b/src/Microsoft.Management.Deployment/packages.config
@@ -1,5 +1,5 @@
-
-
+
+
\ No newline at end of file
diff --git a/src/Update-VcxprojNugetPackageVersions.ps1 b/src/Update-VcxprojNugetPackageVersions.ps1
new file mode 100644
index 0000000000..f329e8caed
--- /dev/null
+++ b/src/Update-VcxprojNugetPackageVersions.ps1
@@ -0,0 +1,292 @@
+#Requires -Version 5.1
+
+<#
+.SYNOPSIS
+ Updates the version of a specific NuGet package across all .vcxproj files and their associated packages.config files.
+
+.DESCRIPTION
+ This script searches for all projects that use a specified NuGet package and updates both the packages.config
+ file and the .vcxproj file to use a new version. It uses Get-VcxprojNugetPackageVersions.ps1 to find target
+ projects and then performs the necessary updates.
+
+.PARAMETER PackageName
+ The name of the NuGet package to update (e.g., "Newtonsoft.Json").
+
+.PARAMETER NewVersion
+ The new version to update to (e.g., "13.0.3").
+
+.PARAMETER WhatIf
+ Shows what changes would be made without actually making them.
+
+.PARAMETER Backup
+ Creates backup files (.bak) before making changes.
+
+.EXAMPLE
+ .\Update-VcxprojNugetPackageVersions.ps1 -PackageName "Newtonsoft.Json" -NewVersion "13.0.3"
+
+.EXAMPLE
+ .\Update-VcxprojNugetPackageVersions.ps1 -PackageName "Microsoft.VisualStudio.TestTools.UnitTesting" -NewVersion "2.2.8" -WhatIf
+
+.EXAMPLE
+ .\Update-VcxprojNugetPackageVersions.ps1 -PackageName "boost" -NewVersion "1.82.0" -Backup:$false
+#>
+
+[CmdletBinding(SupportsShouldProcess)]
+param(
+ [Parameter(Mandatory = $true)]
+ [string]$PackageName,
+
+ [Parameter(Mandatory = $true)]
+ [string]$NewVersion,
+
+ [switch]$Backup
+)
+
+# Import the Get-VcxprojNugetPackageVersions script
+$getPackagesScript = Join-Path $PSScriptRoot "Get-VcxprojNugetPackageVersions.ps1"
+
+if (-not (Test-Path $getPackagesScript)) {
+ Write-Error "Could not find Get-VcxprojNugetPackageVersions.ps1 in the same directory as this script."
+ exit 1
+}
+
+function Update-PackagesConfig {
+ param(
+ [string]$PackagesConfigPath,
+ [string]$PackageName,
+ [string]$OldVersion,
+ [string]$NewVersion,
+ [string]$TargetFramework,
+ [bool]$CreateBackup = $true,
+ [bool]$WhatIfMode = $false
+ )
+
+ if (-not (Test-Path $PackagesConfigPath)) {
+ Write-Warning "packages.config not found: $PackagesConfigPath"
+ return $false
+ }
+
+ try {
+ # Create backup if requested
+ if ($CreateBackup -and -not $WhatIfMode) {
+ $backupPath = "$PackagesConfigPath.bak"
+ Copy-Item $PackagesConfigPath $backupPath -Force
+ Write-Verbose "Created backup: $backupPath"
+ }
+
+ # Load and parse the XML
+ [xml]$packagesXml = Get-Content $PackagesConfigPath -ErrorAction Stop
+
+ $packageNode = $packagesXml.packages.package | Where-Object { $_.id -eq $PackageName }
+
+ if (-not $packageNode) {
+ Write-Warning "Package '$PackageName' not found in $PackagesConfigPath"
+ return $false
+ }
+
+ $currentVersion = $packageNode.version
+
+ if ($WhatIfMode) {
+ Write-Host "WHATIF: Would update $PackagesConfigPath" -ForegroundColor Yellow
+ Write-Host " Package: $PackageName" -ForegroundColor Cyan
+ Write-Host " Current Version: $currentVersion" -ForegroundColor Red
+ Write-Host " New Version: $NewVersion" -ForegroundColor Green
+ return $true
+ }
+
+ # Update the version
+ $packageNode.version = $NewVersion
+
+ # Save the updated XML
+ $packagesXml.Save($PackagesConfigPath)
+
+ Write-Host "Updated packages.config: $PackagesConfigPath" -ForegroundColor Green
+ Write-Host " ${PackageName}: $currentVersion → $NewVersion" -ForegroundColor Cyan
+
+ return $true
+ }
+ catch {
+ Write-Error "Failed to update packages.config '$PackagesConfigPath': $($_.Exception.Message)"
+ return $false
+ }
+}
+
+function Update-VcxprojFile {
+ param(
+ [string]$VcxprojPath,
+ [string]$PackageName,
+ [string]$OldVersion,
+ [string]$NewVersion,
+ [bool]$CreateBackup = $true,
+ [bool]$WhatIfMode = $false
+ )
+
+ if (-not (Test-Path $VcxprojPath)) {
+ Write-Warning ".vcxproj file not found: $VcxprojPath"
+ return $false
+ }
+
+ try {
+ # Read the file content
+ $content = Get-Content $VcxprojPath -Raw -ErrorAction Stop
+
+ # Pattern to match package references in the format "PACKAGE-NAME.VERSION"
+ $oldPattern = [regex]::Escape("$PackageName.$OldVersion")
+ $newPattern = "$PackageName.$NewVersion"
+
+ # Check if there are any matches
+ if ($content -notmatch $oldPattern) {
+ Write-Verbose "No references to $PackageName.$OldVersion found in $VcxprojPath"
+ return $false
+ }
+
+ if ($WhatIfMode) {
+ $regexMatches = [regex]::Matches($content, $oldPattern)
+ Write-Host "WHATIF: Would update $VcxprojPath" -ForegroundColor Yellow
+ Write-Host " Found $($regexMatches.Count) reference(s) to update:" -ForegroundColor Cyan
+ Write-Host " $oldPattern → $newPattern" -ForegroundColor Cyan
+ return $true
+ }
+
+ # Create backup if requested
+ if ($CreateBackup) {
+ $backupPath = "$VcxprojPath.bak"
+ Copy-Item $VcxprojPath $backupPath -Force
+ Write-Verbose "Created backup: $backupPath"
+ }
+
+ # Replace all occurrences
+ $updatedContent = $content -replace $oldPattern, $newPattern
+
+ # Count the number of replacements made
+ $originalMatches = [regex]::Matches($content, $oldPattern).Count
+ $remainingMatches = [regex]::Matches($updatedContent, $oldPattern).Count
+ $replacementCount = $originalMatches - $remainingMatches
+
+ # Save the updated content
+ Set-Content $VcxprojPath -Value $updatedContent -Encoding UTF8 -ErrorAction Stop
+
+ Write-Host "Updated .vcxproj file: $VcxprojPath" -ForegroundColor Green
+ Write-Host " Replaced $replacementCount reference(s): $oldPattern → $newPattern" -ForegroundColor Cyan
+
+ return $true
+ }
+ catch {
+ Write-Error "Failed to update .vcxproj file '$VcxprojPath': $($_.Exception.Message)"
+ return $false
+ }
+}
+
+function Show-UpdateSummary {
+ param(
+ [array]$TargetPackages,
+ [int]$SuccessfulPackagesConfig,
+ [int]$SuccessfulVcxproj,
+ [string]$PackageName,
+ [string]$NewVersion
+ )
+
+ Write-Host "`n=== UPDATE SUMMARY ===" -ForegroundColor Cyan
+ Write-Host "Package: $PackageName" -ForegroundColor White
+ Write-Host "New Version: $NewVersion" -ForegroundColor White
+ Write-Host "Projects found with package: $($TargetPackages.Count)" -ForegroundColor White
+ Write-Host "packages.config files updated: $SuccessfulPackagesConfig" -ForegroundColor Green
+ Write-Host ".vcxproj files updated: $SuccessfulVcxproj" -ForegroundColor Green
+
+ # Show unique versions being replaced
+ $uniqueVersions = $TargetPackages | Group-Object Version | Sort-Object Name
+ if ($uniqueVersions.Count -gt 0) {
+ Write-Host "`nVersions being replaced:" -ForegroundColor Cyan
+ foreach ($version in $uniqueVersions) {
+ Write-Host " $($version.Name) (in $($version.Count) project(s))" -ForegroundColor Yellow
+ }
+ }
+}
+
+# Main execution
+try {
+ Write-Host "Starting package version update process..." -ForegroundColor Cyan
+ Write-Host "Package: $PackageName" -ForegroundColor White
+ Write-Host "New Version: $NewVersion" -ForegroundColor White
+
+ if ($WhatIfPreference) {
+ Write-Host "Mode: WHATIF (no changes will be made)" -ForegroundColor Yellow
+ } else {
+ Write-Host "Backup files: $(if ($Backup) { 'Enabled' } else { 'Disabled' })" -ForegroundColor White
+ }
+
+ Write-Host "`nSearching for projects using package '$PackageName'..." -ForegroundColor Cyan
+
+ # Use the Get-VcxprojNugetPackageVersions script to find target packages
+ $targetPackages = & $getPackagesScript -PackageFilter $PackageName -OutputFormat Object
+
+ if ($targetPackages.Count -eq 0) {
+ Write-Warning "No projects found using package '$PackageName'."
+ return
+ }
+
+ Write-Host "Found $($targetPackages.Count) reference(s) to package '$PackageName'" -ForegroundColor Green
+
+ # Group by project to avoid duplicate processing
+ $projectGroups = $targetPackages | Group-Object ProjectFile
+
+ Write-Host "`nProjects to update:" -ForegroundColor Cyan
+ foreach ($group in $projectGroups) {
+ $project = $group.Group[0] # Get the first package info for project details
+ Write-Host " $($project.ProjectName) - Version(s): $($group.Group.Version -join ', ')" -ForegroundColor White
+ }
+
+ if ($WhatIfPreference) {
+ Write-Host "`n=== WHATIF MODE - SHOWING PLANNED CHANGES ===" -ForegroundColor Yellow
+ } else {
+ Write-Host "`nStarting updates..." -ForegroundColor Cyan
+ }
+
+ $successfulPackagesConfig = 0
+ $successfulVcxproj = 0
+ $processedCount = 0
+
+ foreach ($package in $targetPackages) {
+ $processedCount++
+
+ if (-not $WhatIfPreference) {
+ Write-Progress -Activity "Updating package versions" -Status "Processing $($package.ProjectName)" -PercentComplete (($processedCount / $targetPackages.Count) * 100)
+ }
+
+ # Update packages.config
+ $packagesConfigSuccess = Update-PackagesConfig -PackagesConfigPath $package.PackagesConfigPath -PackageName $PackageName -OldVersion $package.Version -NewVersion $NewVersion -TargetFramework $package.TargetFramework -CreateBackup $Backup.ToBool() -WhatIfMode $WhatIfPreference
+
+ if ($packagesConfigSuccess) {
+ $successfulPackagesConfig++
+ }
+
+ # Update .vcxproj file
+ $vcxprojSuccess = Update-VcxprojFile -VcxprojPath $package.ProjectFile -PackageName $PackageName -OldVersion $package.Version -NewVersion $NewVersion -CreateBackup $Backup.ToBool() -WhatIfMode $WhatIfPreference
+
+ if ($vcxprojSuccess) {
+ $successfulVcxproj++
+ }
+ }
+
+ if (-not $WhatIfPreference) {
+ Write-Progress -Activity "Updating package versions" -Completed
+ }
+
+ # Show summary
+ Show-UpdateSummary -TargetPackages $targetPackages -SuccessfulPackagesConfig $successfulPackagesConfig -SuccessfulVcxproj $successfulVcxproj -PackageName $PackageName -NewVersion $NewVersion
+
+ if ($WhatIfPreference) {
+ Write-Host "`nTo perform these updates, run the script without -WhatIf" -ForegroundColor Yellow
+ } else {
+ Write-Host "`nUpdate process completed!" -ForegroundColor Green
+
+ if ($Backup) {
+ Write-Host "Backup files (.bak) have been created for all modified files." -ForegroundColor Cyan
+ }
+ }
+}
+catch {
+ Write-Error "An error occurred during execution: $($_.Exception.Message)"
+ Write-Error $_.ScriptStackTrace
+ exit 1
+}
diff --git a/src/WinGetServer/WinGetServer.vcxproj b/src/WinGetServer/WinGetServer.vcxproj
index a25a0dec8d..cb90d596c5 100644
--- a/src/WinGetServer/WinGetServer.vcxproj
+++ b/src/WinGetServer/WinGetServer.vcxproj
@@ -173,14 +173,12 @@
-
+
This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.
-
-
-
+
-
\ No newline at end of file
+
diff --git a/src/WinGetServer/packages.config b/src/WinGetServer/packages.config
index c971945382..a4d92efeae 100644
--- a/src/WinGetServer/packages.config
+++ b/src/WinGetServer/packages.config
@@ -1,4 +1,4 @@
-
+
\ No newline at end of file
diff --git a/src/WinGetUtil/WinGetUtil.vcxproj b/src/WinGetUtil/WinGetUtil.vcxproj
index c4e0709d9f..3832db2770 100644
--- a/src/WinGetUtil/WinGetUtil.vcxproj
+++ b/src/WinGetUtil/WinGetUtil.vcxproj
@@ -1,6 +1,6 @@
-
+
true
true
@@ -273,15 +273,16 @@
-
-
+
+
This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.
-
-
-
+
+
+
-
\ No newline at end of file
+
+
diff --git a/src/WinGetUtil/packages.config b/src/WinGetUtil/packages.config
index 7aa172914d..f7979cb735 100644
--- a/src/WinGetUtil/packages.config
+++ b/src/WinGetUtil/packages.config
@@ -1,5 +1,5 @@
-
-
+
+
\ No newline at end of file
diff --git a/src/WinGetYamlFuzzing/WinGetYamlFuzzing.vcxproj b/src/WinGetYamlFuzzing/WinGetYamlFuzzing.vcxproj
index b85d177d22..349ef2541a 100644
--- a/src/WinGetYamlFuzzing/WinGetYamlFuzzing.vcxproj
+++ b/src/WinGetYamlFuzzing/WinGetYamlFuzzing.vcxproj
@@ -100,15 +100,15 @@
-
+
This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.
-
+
-
\ No newline at end of file
+
diff --git a/src/WinGetYamlFuzzing/packages.config b/src/WinGetYamlFuzzing/packages.config
index c971945382..a4d92efeae 100644
--- a/src/WinGetYamlFuzzing/packages.config
+++ b/src/WinGetYamlFuzzing/packages.config
@@ -1,4 +1,4 @@
-
+
\ No newline at end of file
diff --git a/src/WindowsPackageManager/WindowsPackageManager.vcxproj b/src/WindowsPackageManager/WindowsPackageManager.vcxproj
index 727142591f..cef0948b5b 100644
--- a/src/WindowsPackageManager/WindowsPackageManager.vcxproj
+++ b/src/WindowsPackageManager/WindowsPackageManager.vcxproj
@@ -1,6 +1,6 @@
-
+
true
true
@@ -438,15 +438,16 @@
-
-
+
+
This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.
-
-
-
+
+
+
-
\ No newline at end of file
+
+
diff --git a/src/WindowsPackageManager/packages.config b/src/WindowsPackageManager/packages.config
index 7aa172914d..f7979cb735 100644
--- a/src/WindowsPackageManager/packages.config
+++ b/src/WindowsPackageManager/packages.config
@@ -1,5 +1,5 @@
-
-
+
+
\ No newline at end of file
diff --git a/src/Xlang/UndockedRegFreeWinRT/src/UndockedRegFreeWinRT/UndockedRegFreeWinRT/UndockedRegFreeWinRT.vcxproj b/src/Xlang/UndockedRegFreeWinRT/src/UndockedRegFreeWinRT/UndockedRegFreeWinRT/UndockedRegFreeWinRT.vcxproj
index 681e10da91..0a7cfbb304 100644
--- a/src/Xlang/UndockedRegFreeWinRT/src/UndockedRegFreeWinRT/UndockedRegFreeWinRT/UndockedRegFreeWinRT.vcxproj
+++ b/src/Xlang/UndockedRegFreeWinRT/src/UndockedRegFreeWinRT/UndockedRegFreeWinRT/UndockedRegFreeWinRT.vcxproj
@@ -325,12 +325,12 @@
-
+
This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.
-
+
-
\ No newline at end of file
+
diff --git a/src/Xlang/UndockedRegFreeWinRT/src/UndockedRegFreeWinRT/UndockedRegFreeWinRT/packages.config b/src/Xlang/UndockedRegFreeWinRT/src/UndockedRegFreeWinRT/UndockedRegFreeWinRT/packages.config
index c971945382..a4d92efeae 100644
--- a/src/Xlang/UndockedRegFreeWinRT/src/UndockedRegFreeWinRT/UndockedRegFreeWinRT/packages.config
+++ b/src/Xlang/UndockedRegFreeWinRT/src/UndockedRegFreeWinRT/UndockedRegFreeWinRT/packages.config
@@ -1,4 +1,4 @@
-
+
\ No newline at end of file