Skip to content

Instantly share code, notes, and snippets.

@ridercz
Created March 26, 2026 01:17
Show Gist options
  • Select an option

  • Save ridercz/2745de0693034d6584dcc67d5a9be339 to your computer and use it in GitHub Desktop.

Select an option

Save ridercz/2745de0693034d6584dcc67d5a9be339 to your computer and use it in GitHub Desktop.
Migrate all .sln files in given folder and it subfolders to .slnx
@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