Rebuilding My Windows Development Environment

This week, I decided to rebuild my development environment. I was noticing some performance and stability problems, and a fresh start was long overdue. In this post, I’ll describe the steps I used to rebuild my system, and the changes I made along the way to ensure future rebuilds will be easier.

Initial Preparation

The initial preparation just required backing up important files before I wiped the drive and reinstalled Windows. My system includes documents, photos, videos, games, code, and other important files – I use it for everything. However, most of the files are stored in the cloud so no backup was necessary. The only exceptions included source code and video games.

Since all source code was stored on the system hard drive, it would be wiped when I reinstalled Windows. This doesn’t really matter since all projects have a remote repository, I just needed to check for any work in progress and push those changes. Since I have a second hard drive, I choose instead to just move the source code to that drive where it would not be affected by the rebuild.

The video games were also stored on the system drive. Since most of the games were on Steam, I used the Steam backup feature to back up the games to my second drive. In addition, after the rebuild, I created a new Steam Library folder on my second drive, so hopefully, I won’t need to back up games for future rebuilds.

Reinstall Windows

Once the initial preparation was complete, it was time to wipe the system drive and reinstall Windows. The simplest approach is to use the Reset this PC feature that is built into Windows. To access this feature, click Start and type Reset this PC.

When you use this feature there are two options; Keep my files or Remove everything. Since I wanted a fresh start, I chose to remove everything which removes all of my personal files, apps, and settings. The process was very smooth and painless.

Install Applications

Once Windows was back up and running, it was time to reinstall all of the applications. Rather than download and install them individually, I choose to try out the new Windows Package Manager (winget) which is included with Windows 11. Winget is a command-line tool that enables users to discover, install, upgrade and remove configured applications.

The tool is simple to use, just fire up a new command prompt and type winget to get started. For example, if I wanted to install Visual Studio Enterprise 2022, I could use the following command to find the application:

winget search "visual studio enterprise 2022"

The command winget search will show all applications available for installation matching the specified query, For the above example, the following results are displayed:

Name                                  Id                                             Version            Source
---------------------------------------------------------------------------------------------------------------
Visual Studio Enterprise 2022         Microsoft.VisualStudio.2022.Enterprise         17.4.0             winget
Visual Studio Enterprise 2022 Preview Microsoft.VisualStudio.2022.Enterprise-Preview 17.0.0 Preview 2.1 winget

With the results above, I can use the following command to install the application:

winget install Microsoft.VisualStudio.2022.Enterprise

Of course, I don’t want to do this for every application. I built a PowerShell script to save time for the next rebuild:

winget install --id=Microsoft.PowerShell --exact
winget install --id=Microsoft.PowerToys --exact
winget install --id=Microsoft.AzureCLI --exact
winget install --id=Microsoft.AzureStorageExplorer --exact
winget install --id=Microsoft.AzureDataStudio --exact
winget install --id=Docker.DockerDesktop --exact
winget install --id=Microsoft.DotNet.SDK.6 --exact
winget install --id=Microsoft.DotNet.SDK.7 --exact
winget install --id=Microsoft.VisualStudio.2022.Enterprise --exact
winget install --id=Microsoft.VisualStudioCode --exact
winget install --id=Git.Git --exact
winget install --id=GitHub.cli --exact

This significantly reduces the effort to reinstall the applications or to build a new development environment from scratch.

I also took some time to try out winstall. It provides a GUI for the Windows Package Manager (winget) and includes support for building app packs that you can share with others and it also provides a nifty utility to generate scripts to bulk install selected applications.

Using winstall, I created a .NET Development Pack which includes all of the above apps.

Next Steps

While the rebuild was fairly effortless thanks to Windows 11 features such as Reset this PC and the Windows Package Manager, there are many improvements to be made for my next rebuild. Specifically:

  • Backup of development databases. Completely forgot about that! Luckily there was nothing important. Development databases are now located on the second drive, so this won’t be a problem next time.
  • Installation of Visual Studio Code / 2022 extensions. I did this manually since there wasn’t a great deal to install. Still, for future builds, I would like to automate the installation of extensions.
  • General configuration of applications. For example, in Azure Data Studio I would like to backup / restore the settings.json so that I retain my server groups and connections.

For my next rebuild, I’ll keep the above in mind and try to make the process simpler and more complete than the last. When I do, I’ll come back and update this post with any new changes.

Thanks for reading! If you have any suggestions I would love to hear them, please feel free to post any questions or comments below.