When you want to experience the new developer tools, you need to set up a VM on Azure. Now, this takes a while.
On top of that, it’s all “preview”. As in: “might crash”. And in: “if it crashes, there might not be a decent way out”.
I was able to completely mess up my environment. Both data acted weird (getting errors like “record already exists” in an empty table), as the inability to publish any new extension (ending up with pages without controls and such). Completely weird, unexpected, .. stuff. Restarting NSTs didn’t work in all cases, unfortunately.
Now, for me personally, I don’t care too much. I just log an issue on GitHub to let Microsoft know .. and I start from scratch.
Speed up this process
Now, to speed up this process, I decided to script it. And the process is really simple:
- When I have setup a VM, I backup the database
- I have a script that can restore that backup so that I have an original environment again
So, I whenever you have set up a new VM, and before you’re going to do anything with it, one tip could be to backup the database that you ‘re going to use to publish scripts to, by running the script “01_BackupDB.ps1” of my library. It will:
- Install my modules (because it’s going to use them for backing up and restoring)
- Take the backup
- Put the backup on the C:\Backup\backup.bak
When you do encounter any weird behavior like I described above .. or any other reason why you’d like to go back to the original situation of your database .. then simply execute “02_FixBrokenEnvironment.ps1“. It will:
- Stop both server instances
- Restore the backup
- Start and synch both instances
Do I need to?
Of course not. You can just suffer through the same as I did .. and eventually set up a new environment on azure ;-). Same result – it will only take somewhat longer.. .
Now, if you are able to fix any issue in any other way – please don’t hold yourself of putting a comment on this post ;-).