Visual Studio Online is now Codespaces

Hello friends. I hope and pray for your good health in this testing times of a world-wide pandemic. This hard time has demanded a lot of workforce to work from home and collaborate a lot more. Hence my post is related to how we can work and collaborate better using Visual Studio Codespaces. Recently at the Microsoft Build it was announced that developers can now use Visual Studio 2019 with Codespaces. In this post we will learn about what is Codespace, its features and future roadmap. The important thing to note here is that Visual Studio Online is now Codespaces as of April 2020

What is Visual Studio Codespace?

If you have read my earlier article, Visual Studio Online 2019 – Step by step guide, it’s about VS Online which is now renamed as Codespaces. Visual Studio Codespaces is an online development environment in which developers can develop entirely in the cloud.  It’s basically a full-fledged code editor and a hosting environment that resides in your browser. Currently it is in preview and one can sign up here. In case you have already done it, you can login here.

What are the features of Visual Studio Codespaces?

Codespaces enables online cloud enabled testing, debugging nested loops for .NET Core class libraries, web apps and console apps. It also brings a host of other features. We will discuss about the following

  • Razor’s C#, HTML and Blazor completion
  • Using Test Explorer in Codespaces
  • Building and debugging experience
  • LiveShare Technology for console and client apps
  • Future Roadmap
  • Limitations as of now

Razor’s C#, HTML and Blazor completion

The Microsoft Codespaces team have ensured that the experience with C# and .NET remain consistent when connecting to a Codespace project. After you have connected to a Codespace .Net Core project you’ll notice that all the experience related features like code fixes, refactoring, tools, etc. are available for your project. For e.g. we can view Razor’s C#, HTML and Blazor completion.

The Codespaces team has also added context sensitive help when we hover over C#, HTML and TagHelper code when navigating your Razor files.

Another very good feature added to Codespaces is compiler errors in your Razor files whether it be from C#, HTML, or Razor itself. It is currently in preview.

Using Test Explorer in Codespaces

As developers we use Test Explorer to view and execute test cases within Visual Studio. This is also one of the important capabilities enabled in Codespaces.

On executing the test cases, Codespace will be responsible to run them so large loop based tests will be able to take advantage of the compute power in case you’ve chosen a larger Codespace. We can also scale up.

Building and debugging experience

While developing our application, the build and debug experience will also be to be similar in the Codespaces environment as in our locally installed Visual Studio. The only difference is that the compilation and debugging is happening on the cloud environment. This is true for breakpoints, watch windows, etc.

LiveShare Technology for console and client apps

As seen in the below image we can see that while working on client apps or console applications our app experience is same because it is remoted back from Codespaces

We can interact with our console app although it will be running in the cloud.In case of web applications like an ASP.NET web app we don’t have to change the launch settings for running as localhost. Here Codespaces uses the LiveShare technology to enable port forwarding of localhost to the app running on the cloud.  When our ASP.NET app executes the first time, a few prompts will be shown in order to trust the certificate created on the Codespace to our machine.

After accepting the certificate, when we run the web app,we can interact with our local browser and also debug normally as we would on our local machines.

Future Roadmap

After making all the above functionality cloud-based online, the Codespaces team is working on leveraging it to power the Live Unit Testing using cloud-based compute resources instead of local resources on our machines. Another feature the team is working on is to target more than one operation systems targets in some conditions. We can run tests on Linux and Windows without leaving our development environment. This can be done by just changing the running target as shown below

Limitations as of now

The Codespaces team recommends using Codespaces for –

  • .NET Core projects that are library apps, console or ASP.NET Core.
  • Apps with UI which are dependant on designers will be taken in future versions.
  • Apps that are ‘server-ready’ that run independently will be the easiest to start with.
  • In this preview version, no Azure services can connect to the development environment of your app including KeyVault and AAD integration.
  • Some of the features like CodeLens and NuGet Package Manager, etc. will also not be available in this first preview.
  • The Codespaces team is working to enable the above features and will be updating the Codespaces service and Visual Studio as well.

Summary

As we learnt in this post that Visual Studio Codespaces has a browser-based editor with support for extensions, built-in command line interface and Git repos so we can edit, run, and debug  our applications from any device. We can also code, build, test, debug, and deploy with a complete development environment from within our browser.

I would love to hear from you, please use the comments section below to share anything you would like. I once again pray for the good health of you and your loved ones. Please stay home, stay safe and keep learning.

Hitesh Boricha

I have a little over a decade experience in the IT industry. Having worked in various roles in this industry, I am passionate about technology.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.