eng/packages/http-client-csharp/eng/scripts/docs/RegenPreview.md
RegenPreview.ps1 is a PowerShell script that automates the process of building local generator packages and regenerating libraries for validation purposes.
This script is designed to streamline the workflow for testing changes to the TypeSpec HTTP Client C# generator before submitting a pull request.
When making changes to the TypeSpec HTTP Client C# generator, it may be helpful to validate what the effects will be to generated libraries. This script automates the entire validation workflow by:
-Select is specified)azure-sdk-for-net repositoryWindows:
.\RegenPreview.ps1
Linux/macOS:
./RegenPreview.ps1
This will:
-Select (Optional)When specified, displays an interactive menu to select specific libraries to regenerate. If omitted, all libraries are regenerated automatically.
Can be combined with generator filter parameters (-Azure, -Unbranded, -Mgmt) to interactively select from a filtered subset.
Example:
.\RegenPreview.ps1 -Select
-Azure (Optional)When specified, only regenerates libraries using the Azure-branded generator (@azure-typespec/http-client-csharp).
Example:
.\RegenPreview.ps1 -Azure
-Unbranded (Optional)When specified, only regenerates libraries using the unbranded generator (@typespec/http-client-csharp).
Example:
.\RegenPreview.ps1 -Unbranded
-Mgmt (Optional)When specified, only regenerates libraries using the management plane generator (@azure-typespec/http-client-csharp-mgmt).
If no generator filter parameter is specified, all libraries are regenerated by default.
Example:
.\RegenPreview.ps1 -Mgmt
When running with the -Select flag, the script presents an interactive menu listing all available libraries:
==================== LIBRARY SELECTION ====================
Found 28 libraries available for regeneration
Azure-branded libraries (@azure-typespec/http-client-csharp):
[ 1] Azure.AI.VoiceLive (ai)
[ 2] Azure.Data.AppConfiguration (appconfiguration)
...
Unbranded libraries (@typespec/http-client-csharp):
[12] Azure.AI.Projects (ai)
[13] Azure.AI.OpenAI (openai)
Management plane libraries (@azure-typespec/http-client-csharp-mgmt):
[14] Azure.ResourceManager.AgriculturePlatform (agricultureplatform)
[15] Azure.ResourceManager.ArizeAIObservabilityEval (arizeaiobservabilityeval)
...
Enter library numbers to regenerate (comma-separated), 'all' for all libraries, or 'q' to quit:
Example: 1,3,5 or 1-4,7 or all
Selection Options:
11,3,51-41-4,7,10allqIf the script encounters an error during pre-requisite steps (Steps 1-6), it will:
NuGet.Config to prevent leaving the repository in an inconsistent stateAll packaged artifacts are stored in the debug folder at the root of the azure generator:
azure-typespec-http-client-csharp-{version}.tgz - Azure generator npm packageAzure.Generator.{version}.nupkg - Core generator NuGet packageregen-report.json - Detailed JSON report of regeneration resultsThe script provides colored console output with:
After regeneration completes, a summary report is displayed:
==================== REGENERATION REPORT ====================
Total Libraries: 3
Passed: 2
Failed: 1
Execution Time: 00:02:45
PASSED LIBRARIES:
✓ Azure.AI.VoiceLive (ai)
✓ Azure.AI.Projects (cognitiveservices)
FAILED LIBRARIES:
✗ Azure.Messaging.EventGrid.Namespaces (eventgrid)
Error: Generation failed with exit code 1
Details: ...
=============================================================
Detailed report saved to: C:\...\debug\regen-report.json
# You want to test Azure generator changes on specific libraries only
.\RegenPreview.ps1 -Select
# Select just one or two libraries when prompted
# Selection: 1,5
.\RegenPreview.ps1