From zero to hero setup a .NET web development machine fast

Share

I must be getting old, I found the Windows 10 reinstall super easy and efficient. I didn't spend hours tweaking floppy disks to get just the right amount of 640kb of ram to be able to install. Or insert one floppy disk after another as the install progressed. 

This youngens don't understand the pain of proper installs ;-) 

I jest, but seriously you can get this stuff done so fast. I had a Windows 10 machine with all the dev tools in two hours (that's including Windwos 10 install).

Run this Powershell script as admin

You did check what it did first right? It downloads Chocolatey to your machine. Then enables IIS and installs URL Rewrite and Web Deploy modules.

Tell Windows Defender to bog off. These lines are examples of some things you might want to consider telling Windows Defender to not scan. You will probably want to do the same with your Antivirus whatever that is.

Add-MpPreference -ExclusionPath "C:\Windows\Microsoft.NET"
Add-MpPreference -ExclusionPath "c:\data"
Add-MpPreference -ExclusionPath "c:\solr"
Add-MpPreference -ExclusionPath "c:\inetpub\wwwroot\"
Add-MpPreference -ExclusionPath "c:\Program Files (x86)\MongoDB"
Add-MpPreference -ExclusionPath "c:\databases"

Depending on circumstances you might want to off load some of the work load from your drive C: to somewhere else. Don't forget you can sym link drives.

 

mklink /J "c:\data" "e:\data"
mklink /J "c:\solr" "e:\solr"
mklink /J "c:\inetpub\wwwroot\someclientfolder" "D:\wwwroot\someclientfolder"
mklink /J "c:\Program Files (x86)\MongoDB" "e:\Program Files (x86)\MongoDB"
mklink /J "c:\databases" "e:\databases"

Doing this the website still thinks its on drive C: yet is actually somewhere else. 

The advantages of this are with sites that have hardcoded paths will "just work" nothing needs changing. 

You can install all your normal work stuff with a few commands.

choco install nodejs.install --version=
npm install -g grunt-cli
choco install slack
choco install whatsapp
choco install javaruntime
choco install winrar
choco install googlechrome
choco install notepadplusplus.install
choco install visualstudio2022community
choco install steam-client
choco install mongodb
choco install sql-server-management-studio
choco install sql-server-2019 --params="'/ConfigurationFile:C:\Users\user\Desktop\configurationfile.ini'"
choco install geforce-experience
choco install dotnetcore-3.1-sdk
choco install kdiff3
choco install netfx-4.5.2-devpack
Install-WindowsFeature Telnet-Client
choco install azure-cli

The command for SQL Server you can pass it a configuration file. This can be generated to follow any guide lines you like by running the normal installer and walking through it till you get to the "Ready to deploy" step. That step will have a file path to the configuration file it will use for the install like the one linked above.

If you want docker we can do that too.

choco install docker-desktop
choco install wsl2
Enable-WindowsOptionalFeature -Online -FeatureName $("Microsoft-Hyper-V", "Containers") -All

The first line installs Docker for Windows, the second the linux containers sub system, and the third the windows containers.

After installation you might also want to set it as Windows Containers and change its location for images to take the load off the windows drive. This is done like this

{
  "data-root": "e:\\DockerImages",
  "dns": [
    "8.8.8.8"
  ],
  "experimental": false
}

Click the cog icon in Docker for Windows, then Docker Engine change the json however you like click save.

You might also want to set PowerShell to let you run any PowerShell you like using:

Set-ExecutionPolicy -ExecutionPolicy Bypass -Scope CurrentUser

All of the above should hopefully get you going. It's crazy how quickly you can get this stuff done now and hopefully the above tips will help speed up your next setup.