Upgrading an app
An app made with dotnet new saas-starter is your code, not a package: updating the template (dotnet new update) changes only apps you create afterwards. To bring an existing app up to a later version, you apply the template's changes to it as a patch, then resolve whatever clashes with your own changes, as you would when merging a branch.
1. Read what changed
Each version's release notes list the changes to know about: renamed types, changed endpoints, new settings, and database migrations. The guides on this site (in the sidebar) go through each upgrade step by step. Go one version at a time when you're several behind: each step is smaller, and its guide applies.
2. Make a patch for your app
upgrade-patch.sh generates your app twice, at the version you have and the one you want, with your app's name and the options you chose, and writes the difference as a patch. It needs the .NET SDK and git, and leaves the template you have installed alone.
curl -fsSLO https://libresharp.github.io/saas-starter/latest/upgrade-patch.sh
chmod +x upgrade-patch.sh
./upgrade-patch.sh 0.7.0 0.8.0 MyApp --Persistence efcore --Auth saasPass the same name and options you used with dotnet new (the defaults are --Persistence marten --Auth saas --IncludeTests true --Aspire false). The patch covers everything the template changed: code, tests, docs, package versions and, with EF Core, migrations.
On Windows, run it in Git Bash or WSL.
3. Apply it
On a clean working tree, at the root of your app's repository:
git switch -c upgrade-to-0.8.0
git apply -3 upgrade.patch
git status-3 merges each file the way git merge would, so your changes stay. Files you changed in the same places as the template are left with conflict markers to resolve. That works when your history still has the files as first generated: commit the app before changing it.
If git apply can't find a file's original (repository lacks the necessary blob), that file was changed before its first commit. Apply the rest with git apply -3 --reject upgrade.patch and copy that file's changes across by hand from the .rej file.
4. Check it
dotnet build
dotnet test
cd src/Client && npm install && npm run gen:api && npm run lint && npm test- Regenerate the API client (
npm run gen:api, with the API running) rather than resolving conflicts insrc/Client/src/lib/api/schema.d.tsby hand: it's generated from your API. - EF Core: if you added migrations of your own,
AppDbContextModelSnapshot.cswill conflict. Keep both sides' entities, then check that the snapshot matches the model:dotnet ef migrations has-pending-model-changes --project src/MyApp. The template's new migrations are applied at startup, like yours. - Marten changes its schema itself at startup in Development. In production, follow your usual way of applying Marten's schema changes.
- Read the version's guide for changes the compiler won't catch, such as new settings and changed defaults.
Upgrade guides
- To v0.8.0: two-factor authentication and account security.
Versions before v0.8.0 have release notes but no guide: use the patch and the notes' "Changes to know about".