A command-line tool to automatically migrate appsettings.json files to the latest configuration version for the LinkDotNet.Blog application.
- Automatic migration - Detects current configuration version and applies necessary migrations
- Version tracking - Adds
ConfigVersionfield to track configuration schema version - Safe backups - Creates timestamped backups before making any changes
- Colorful output - Uses color-coded console messages for better visibility
- Dry-run mode - Preview changes without applying them
- Multi-file support - Can process multiple appsettings files in a directory
Build the tool from source:
cd tools/LinkDotNet.Blog.UpgradeAssistant
dotnet buildNavigate to your project directory containing appsettings.json and run:
dotnet run --project tools/LinkDotNet.Blog.UpgradeAssistantMigrate a specific file or directory:
dotnet run --project tools/LinkDotNet.Blog.UpgradeAssistant -- --path /path/to/appsettings.json
dotnet run --project tools/LinkDotNet.Blog.UpgradeAssistant -- --path /path/to/config/directoryPreview changes without applying them:
dotnet run --project tools/LinkDotNet.Blog.UpgradeAssistant -- --dry-runSpecify a custom backup location:
dotnet run --project tools/LinkDotNet.Blog.UpgradeAssistant -- --backup-dir ./my-backups| Option | Short | Description |
|---|---|---|
--path <path> |
-p |
Path to appsettings.json file or directory. Defaults to current directory. |
--dry-run |
-d |
Preview changes without applying them. |
--backup-dir <path> |
-b |
Custom backup directory path. Defaults to './backups'. |
--help |
-h |
Display help message. |
--version |
-v |
Display tool version. |
The tool currently supports migrations from version 8.0 to 12.0:
- Moves donation settings (
KofiToken,GithubSponsorName,PatreonName) toSupportMesection - Adds
ShowSimilarPostssetting
- Adds
UseMultiAuthorModesetting
- Adds
ShowBuildInformationsetting
After migration, your appsettings.json will include a ConfigVersion field:
{
"ConfigVersion": "12.0",
...
}This field is used to track the configuration schema version and determine which migrations need to be applied.
- Always backup your configuration files before running migrations (the tool does this automatically)
- Review changes after migration to ensure all settings are correct
- Database migrations may be required separately - see
MIGRATION.mdfor details - The tool is idempotent - running it multiple times on the same file is safe
dotnet run --project tools/LinkDotNet.Blog.UpgradeAssistantdotnet run --project tools/LinkDotNet.Blog.UpgradeAssistant -- --dry-rundotnet run --project tools/LinkDotNet.Blog.UpgradeAssistant -- \
--path ./appsettings.Production.json \
--backup-dir ./config-backupsMake sure you're in the correct directory or specify the path using --path option.
Ensure your appsettings file is valid JSON before running the migration.
If you see "No migrations needed", your configuration is already at the latest version.
- MIGRATION.md - Manual migration guide
- Configuration Documentation - Configuration options