-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Update C++ nuget package references using new scripts #5877
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
This comment was marked as outdated.
This comment was marked as outdated.
| <Error Condition="!Exists('$(SolutionDir)\packages\Microsoft.Windows.CppWinRT.2.0.250303.1\build\native\Microsoft.Windows.CppWinRT.targets')" Text="$([System.String]::Format('$(ErrorText)', '$(SolutionDir)\packages\Microsoft.Windows.CppWinRT.2.0.250303.1\build\native\Microsoft.Windows.CppWinRT.targets'))" /> | ||
| </Target> | ||
| </Project> | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: two empty lines
|
|
||
| [CmdletBinding()] | ||
| param( | ||
| [ValidateSet("Table", "CSV", "JSON", "Object")] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need all of these? I don't see why we would ever use anything but Object
| [ValidateSet("Table", "CSV", "JSON", "Object")] | ||
| [string]$OutputFormat = "Table", | ||
|
|
||
| [string]$ExportPath, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need this? If I want to write to file I can just | Out-File (and apply whatever format I want inbetween)
| try { | ||
| $vcxprojFiles = Get-ChildItem -Path $SearchPath -Filter "*.vcxproj" -Recurse -ErrorAction SilentlyContinue | ||
| if (-not $SuppressOutput) { | ||
| Write-Host "Found $($vcxprojFiles.Count) .vcxproj files" -ForegroundColor Green |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Write-Verbose ?
| $packages = @() | ||
|
|
||
| if (-not (Test-Path $PackagesConfigPath)) { | ||
| Write-Verbose "No packages.config found for project: $ProjectName" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The AI does know about Write-Verbose!
|
|
||
| # Main execution | ||
| try { | ||
| $scriptPath = Split-Path -Parent $MyInvocation.MyCommand.Path |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
$PSScriptRoot
| Shows what changes would be made without actually making them. | ||
| .PARAMETER Backup | ||
| Creates backup files (.bak) before making changes. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But I like git...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It wanted to default that on...
| $oldPattern = [regex]::Escape("$PackageName.$OldVersion") | ||
| $newPattern = "$PackageName.$NewVersion" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably not much of a concern, but this wouldn't work if a package adds a props or targets file in the new version.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I'm expecting that if that happens we will have to apply it to a single project and then figure out how to get that into the rest of them. On the plus side, the Get script makes for an easier starting point.
florelis
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't like some things about it, but if it works well enough and we're not shipping it...
Change
Adds scripts to view the nuget package references in C++ projects and update them en-masse. Use them to update C++/WinRT and WIL to the latest version.
Get-VcxprojNugetPackageVersions
This script lets you get the set of packages in use by all C++ projects. You can provide a
-PackageFilterto target a specific package. It gives you a link to the package on nuget.org to use in the update script.Update-VcxprojNugetPackageVersions
This script updates a single package to a new version across all projects. It supports
-WhatIfto inspect what will happen before doing it (although I would always suggest running it on a clean git state so that you can undo easily).Microsoft Reviewers: Open in CodeFlow