Discover how Dropbox streamlined dev environments & cut costs by switching 1000 developers to Coder

Read the success story

Microsoft Windows & Visual Studio in Coder

author avatar
Mark Milligan
 on December 23rd, 2022

Microsoft Corporation in many ways is one of the founders of developer tools. Visual Studio (not to be confused with Visual Studio Code "VS Code" an open-source IDE which Coder's code-server project is based on) has been around since 1997 with thirteen releases including 2022 in November 2021.

One IDE, multiple languages

The concept is one Integrated Development Environment "IDE" can be used for multiple languages, so beginning with Visual C++, Visual Basic and Visual FoxPro. Over the years as new languages and frameworks emerge from Microsoft, support expanded to Visual J++, J#, C#, the .NET Framework including ASP.NET. The Stack Overflow 2022 Developer Survey lists Visual Studio as the #2 IDE behind VS Code at 32%.

Visual Studio requires a Microsoft Windows operating system to run, so for remote development to be an option, the remote development environment must be able to run Windows and have a way to visual connect to it and the IDE.

In Coder v2, we expanded our infrastructure integration ecosystem by embedding Terraform as the declarative language to define workspaces and a provisioner runner to build workspaces. This means a development environment in Coder can run Microsoft Windows and Visual Studio, on any VM infrastructure they prefer. e.g., AWS, Google Cloud, Azure, etc. In the following example, our Terraform configuration, what we call a template, will be on Google Cloud.

Input variables

Your DevOps or development team leads may hard-code these values in the Terraform template, but you can prompt the developer in the UI at workspace (our term for a development environment) creation, for the cloud region, machine type, Windows and Visual Studio releases.

The Terraform template section for cloud, Windows and IDE inputs
The Create Workspace UI surfacing the template input variables

The beauty of Terraform is infrastructure is just a resource block, so in this case a Google Compute resource where the input variables like region, machine type, and Windows OS machine image are specified.

The Terraform resource for a Google Cloud VM

Bootstrap scripts

Within the Google Compute resource, you run PowerShell commands to install a package manager and run additional PowerShell commands in the Coder agent's init_script to install Visual Studio.

PowerShell invoked at workspace creation to add a package manager and run the Coder init_script

There are some other housekeeping items like enabling the Remote Desktop Protocol "RDP" and in Windows 2022, the Administrator user is disabled by default and a password needs to be created. Notice the Terraform input variables speckled amongst the PowerShell commands for items like an Administrator password default and the Visual Studio release.

The Coder startup_script with PowerShell installing Visual Studio

Metadata to surface in the Coder Workspace UI

Coder has Terraform resources as well like coder_metadata to surface helpful items for the user like the default Administrator password, the region and machine type of the cloud VM-based workspace and the releases of Windows and Visual Studio installed.

Workspace metadata to surface in the Coder UI to help developers

Markdown to help developers

Each Coder template includes a markdown file which is shown in the Coder UI at workspace creation to help the developer understand what is included in the workspace. DevOps or the development team lead would write this and make them specific to their team and organization.

The workspace's markdown file to inform developers at workspace creation

A Running Windows and Visual Studio Workspace in Coder

The workspace UI in Coder running PowerShell session and instantiated from the Coder Terminal button

Forward the RDP port to a local machine

While browser-based RDP approaches like Apache Guacamole can work, this example is using a Microsoft RDP client to connect to the Coder Windows and Visual Studio workspace. To complete that connection, you need to forward the RDP port from the Coder workspace to your local machine using the Coder CLI, which by the way is the same as the Coder server binary. We did that for virality reasons. i.e., anyone trying out Coder should be able to fire up their own personal remote development instance.

The Coder CLI invoking a subcommand to forward the workspace's RDP port to a different local port
The Microsoft RDP client with the forwarded port on localhost for remotely accessing the Coder workspace

Accessing Microsoft Windows & Visual Studio

After connecting with the RDP client and entering the Administrator password, Windows appears and you can start Visual Studio. Your own private Windows machine in the cloud.

Microsoft Windows and Visual Studio running in a Coder workspace

Summary Thoughts and Why Coder

While it is helpful that we can demonstrate running both the Microsoft Windows operating system and a Microsoft Visual Studio IDE in a Coder workspace, the real business benefit and differentiator is that an enterprise can invest in one remote development platform like Coder and have it serve multiple developer use cases, e.g., Java, Node, Go, C#, C++, Python, which is a lower total cost of ownership and a better return on your remote development investment.

Developers and data scientists can learn one remote development platform while still using the same IDEs they use today on local machines, so there are lower training requirements. DevOps and Platform Engineering teams only have to learn and manage one remote development platform. Information Security and Technology Risk teams only have to do penetration tests and review one remote development platform. Cloud cost management teams can rest easy knowing Coder provides auto-off and resource quotas to restrict cloud costs.

Unlike alternative cloud or git provider remote development offerings, Coder can run any cloud, OS, Git, or IDE

The alternative solutions on the market are pay-as-you-go that may only support one cloud provider, one operating system, one Git provider, or one IDE, potentially leading to multiple solutions required to meet an enterprise's remote software development needs.

See the public repositories for the Google Cloud and AWS Windows and Visual Studio template examples to start building your own.

Contact Sales if you have a remote development initiative in the works or try out Coder v2's OSS or Enterprise paid offerings.

Subscribe to our Newsletter

Want to stay up to date on all things Coder? Subscribe to our monthly newsletter and be the first to know when we release new things!