|
| 1 | +# NuGet.exe to dotnet CLI Migration Summary |
| 2 | + |
| 3 | +## Overview |
| 4 | +Successfully migrated GitHub Actions workflows from using `nuget.exe` (with Mono) to the modern `dotnet CLI` approach. |
| 5 | + |
| 6 | +## Changes Made |
| 7 | + |
| 8 | +### 1. Created Conversion Script |
| 9 | +- **File**: `convert-nuget-to-dotnet.sh` |
| 10 | +- **Purpose**: Automated script to convert existing workflows |
| 11 | +- **Features**: |
| 12 | + - Detects and converts `nuget source Add` to `dotnet nuget add source` |
| 13 | + - Converts `nuget push` to `dotnet nuget push` |
| 14 | + - Adds `actions/setup-dotnet@v4` to workflows that need .NET SDK |
| 15 | + - Removes deprecated `nuget/setup-nuget@v1` action |
| 16 | + |
| 17 | +### 2. Updated Workflow Files |
| 18 | + |
| 19 | +#### `.github/workflows/csharp.yml` |
| 20 | +- **Before**: Used `nuget source Add` and `nuget push` commands |
| 21 | +- **After**: Uses `dotnet nuget add source` and `dotnet nuget push` |
| 22 | +- **Authentication**: Updated to use `--store-password-in-clear-text` flag for GitHub Package Registry |
| 23 | +- **Added**: `actions/setup-dotnet@v4` with .NET 8.0.x |
| 24 | + |
| 25 | +#### `.github/workflows/AutoMerge.yml` |
| 26 | +- **Added**: `actions/setup-dotnet@v4` for consistency (though not strictly needed for this workflow) |
| 27 | + |
| 28 | +#### `.github/workflows/cpp-test.yml` |
| 29 | +- **Added**: `actions/setup-dotnet@v4` for consistency |
| 30 | + |
| 31 | +#### `.github/workflows/deploy-cpp.yml` |
| 32 | +- **Added**: `actions/setup-dotnet@v4` for consistency |
| 33 | + |
| 34 | +## Key Benefits |
| 35 | + |
| 36 | +1. **Modern Approach**: Uses the official .NET CLI instead of Mono-based nuget.exe |
| 37 | +2. **Better Performance**: Native .NET CLI is faster than Mono-based nuget.exe |
| 38 | +3. **Consistent Tooling**: Aligns with modern .NET development practices |
| 39 | +4. **Future-Proof**: Uses the recommended approach for .NET 8.0+ |
| 40 | +5. **Simplified Setup**: No need for separate nuget setup action |
| 41 | + |
| 42 | +## Commands Converted |
| 43 | + |
| 44 | +| Old Command | New Command | |
| 45 | +|-------------|-------------| |
| 46 | +| `nuget source Add -Name "GitHub" -Source "..." -UserName ... -Password ...` | `dotnet nuget add source ... --name GitHub --username ... --password ... --store-password-in-clear-text` | |
| 47 | +| `nuget push **/*.nupkg -Source "GitHub" -SkipDuplicate` | `dotnet nuget push **/*.nupkg --source GitHub --skip-duplicate` | |
| 48 | + |
| 49 | +## Testing |
| 50 | + |
| 51 | +The conversion script was tested and successfully: |
| 52 | +- ✅ Detected workflow files in `.github/workflows/` |
| 53 | +- ✅ Converted nuget commands to dotnet CLI equivalents |
| 54 | +- ✅ Added setup-dotnet actions where needed |
| 55 | +- ✅ Preserved GitHub secrets and authentication |
| 56 | +- ✅ Maintained proper YAML formatting |
| 57 | + |
| 58 | +## Files Modified |
| 59 | + |
| 60 | +1. `convert-nuget-to-dotnet.sh` (new file) |
| 61 | +2. `.github/workflows/csharp.yml` |
| 62 | +3. `.github/workflows/AutoMerge.yml` |
| 63 | +4. `.github/workflows/cpp-test.yml` |
| 64 | +5. `.github/workflows/deploy-cpp.yml` |
| 65 | + |
| 66 | +## Next Steps |
| 67 | + |
| 68 | +1. **Review**: The changes have been committed and pushed to the repository |
| 69 | +2. **Test**: Run the workflows to ensure they work correctly with the new dotnet CLI commands |
| 70 | +3. **Monitor**: Watch for any issues in the GitHub Package Registry publishing |
| 71 | +4. **Document**: Update any documentation that references the old nuget.exe approach |
| 72 | + |
| 73 | +## Issue Reference |
| 74 | + |
| 75 | +This migration addresses [Issue #120](https://github.com/linksplatform/Interfaces/issues/120) for migrating from nuget.exe to dotnet CLI. |
0 commit comments