-
Notifications
You must be signed in to change notification settings - Fork 757
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
Fix MakeApiBaselines.ps1 script #4587
Conversation
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.
Thanks!
Please let me review this. |
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.
Whilst this change technically is not incorrect, it requires the caller the have restored the toolset.
I suggest the following change which allows the scripts to be run as a standalone:
diff --git a/scripts/MakeApiBaselines.ps1 b/scripts/MakeApiBaselines.ps1
index c524a201d9..3fc3c3d390 100644
--- a/scripts/MakeApiBaselines.ps1
+++ b/scripts/MakeApiBaselines.ps1
@@ -10,14 +10,17 @@ if ($PSVersionTable.PSVersion.Major -lt 6) {
exit
}
+# Install required toolset
+. $PSScriptRoot/../eng/common/tools.ps1
+InitializeDotNetCli -install $true | Out-Null
+
$Project = $PSScriptRoot + "/../eng/Tools/ApiChief/ApiChief.csproj"
$Command = $PSScriptRoot + "/../artifacts/bin/ApiChief/Debug/net8.0/ApiChief.dll"
-$DotnetCommand = $PSScriptRoot + "/../.dotnet/dotnet"
$LibrariesFolder = $PSScriptRoot + "/../src/Libraries"
Write-Output "Building ApiChief tool"
-& $DotnetCommand build $Project --nologo --verbosity q
+dotnet build $Project --nologo --verbosity q
Write-Output "Creating API baseline files in the src/Libraries folder"
@@ -26,5 +29,5 @@ Get-ChildItem -Path $LibrariesFolder -Depth 1 -Include *.csproj | ForEach-Object
$name = Split-Path $_.FullName -LeafBase
$path = "$PSScriptRoot\..\artifacts\bin\$name\Debug\net8.0\$name.dll"
Write-Host " Processing" $name
- & $DotnetCommand $Command $path emit baseline -o "$LibrariesFolder/$name/$name.json"
+ dotnet $Command $path emit baseline -o "$LibrariesFolder/$name/$name.json"
}
@RussKie I've applied the changes. Thank you. |
When running
MakeApiBaselines.ps1
script it was failing and reporting an error that it couldn't find SDK8.x.x-rtm...
. The error was occurring because the script was using globaldotnet
tool rather than locally installed.\.dotnet\dotnet.exe
.The PR fixes the script to use the local
dotnet
tool.Microsoft Reviewers: Open in CodeFlow