Created
March 26, 2026 01:17
-
-
Save ridercz/2745de0693034d6584dcc67d5a9be339 to your computer and use it in GitHub Desktop.
Migrate all .sln files in given folder and it subfolders to .slnx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @ECHO OFF | |
| SETLOCAL ENABLEDELAYEDEXPANSION | |
| SET "ROOT=%CD%" | |
| SET "DRYRUN=0" | |
| :PARSE_ARGS | |
| IF "%~1"=="" GOTO ARGS_DONE | |
| IF /I "%~1"=="--DRY-RUN" SET "DRYRUN=1" | |
| IF /I "%~1"=="/DRY-RUN" SET "DRYRUN=1" | |
| IF NOT "%~1"=="--DRY-RUN" IF NOT "%~1"=="/DRY-RUN" ( | |
| SET "ROOT=%~1" | |
| ) | |
| SHIFT | |
| GOTO PARSE_ARGS | |
| :ARGS_DONE | |
| ECHO Scanning "%ROOT%" for .SLN files to migrate... | |
| FOR /R "%ROOT%" %%F IN (*.SLN) DO ( | |
| IF "!DRYRUN!"=="1" ( | |
| ECHO Would migrate %%F | |
| ) ELSE ( | |
| dotnet sln "%%F" migrate | |
| IF EXIST "%%~DPNF.SLNX" ( | |
| DEL "%%F" | |
| ) ELSE ( | |
| ECHO -> Migration failed for %%F, .SLNX file not found. | |
| ) | |
| ) | |
| ) | |
| ECHO Done. | |
| ENDLOCAL |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment