Tidy up - Unused Project and Nuget package reference using Visual Studio 2019

If you are a Developer/Architect using Visual Studio as IDE for your development activities, this blog post will be of your interest. During the Ignite 2021 conference, Microsoft released Visual Studio 2019 v16.9 and v16.10 Preview 1. As part of version 16.10 Preview 1, one of the cool features they introduced is to "Remove Unused References..." for any Projects and Nuget packages that are not in use. At the time of writing this blog post, we have Visual Studio Version 16.10.0 (official release) which includes this new feature.  As part of development, we generally get carried away and introduce new Nuget package references to your project and add new references to your Projects. By the end of development, you will not be 100% sure which are not being referenced and unused which means you will leave those unused project references in your application. Now you might be wondering what's the big deal in it since it doesn't harm. The advantage of removing unused project r

WSL2: Linux on Windows

Windows Subsystem for Linux (WSL) 2 is no longer just for insiders, you can install WSL2 today with Windows 10, Version 2004, Build 19041 or higher. The Windows Subsystem for Linux lets developers run a Linux environment on Windows like command-line tools, utilities, and applications directly on Windows, unmodified, without the overhead of a traditional virtual machine or dual boot setup. 

WSL 2 provides improvements to file system sharing, boot time and allows access to some cool new features for Docker Desktop users. With Docker Desktop running on WSL 2, users can leverage Linux workspaces and avoid having to maintain both Linux and Windows build scripts. In short, now we can have a Linux development environment on Windows.

Step 1:  Update Windows 10 to version 2004 or higher

To use WSL2, Windows 10 has to be updated to version 2004 (Build 10941) or higher. Once installed or updated check your Windows version by opening the “Run” dialog (Windows key + R) and enter winver.

Step 2: Turn Windows features on

Once the system restarted from step 1, navigate to the control panel -- Turn Windows features on or off.  Then Enable both ‘Virtual Machine Platform’ and ‘Windows Subsystem for Linux’. Restart your computer.

After the restart of the system if Docker is already installed on windows it pops up with below window to "Enable WSL 2"

As part of Enable WSL 2, you need to install WSL 2 Linux kernel from here. Now if we go Docker, Settings - General ‘Use the WSL 2 base engine’ will be selected. 

Step 3: Installing a Linux distribution

Once the system restarted from step 2, navigate to the Microsoft Store and install Linux distribution. I am going with Ubuntu.

Once the Linux distribution has been installed, You will be asked to create a username and password when you launch Linux for the first time, these need not be your windows system you can choose new username and password.


you can exit from the above window by typing exit and clicking enter.

Step 4: WSL1 to WSL2 

Open Command prompt or Windows Powershell and check the version of WSL by using the command wsl -l -v. If the version is 2 all good to go else we need to set version to 2 as shown below

If you want to make WSL 2 your default architecture you can do so with below command
wsl --set-default-version 2

What apps I can run in WSL2?

With WSL2 you can run things like Docker, Kubernetes, etc. WSL2 works with Visual Studio Code as well. Now you can run .NET core console and web apps in WSL2 and debug directly from Visual Studio 2019

Comments

Popular posts from this blog

Tidy up - Unused Project and Nuget package reference using Visual Studio 2019

Swagger UI for Azure Function v2 & v3 APIs

Authenticate Azure Functions - API Keys