DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports Events Over 2 million developers have joined DZone. Join Today! Thanks for visiting DZone today,
Edit Profile Manage Email Subscriptions Moderation Admin Console How to Post to DZone Article Submission Guidelines
View Profile
Sign Out
Refcards
Trend Reports
Events
Zones
Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
  1. DZone
  2. Coding
  3. Tools
  4. Visual Studio on Linux

Visual Studio on Linux

Want to run C# on a Linux VM? Get a head start here with this handy tutorial that shows you how to get set up with Kubuntu.

Gunnar Peipman user avatar by
Gunnar Peipman
·
Jan. 24, 17 · Tutorial
Like (3)
Save
Tweet
Share
8.98K Views

Join the DZone community and get the full member experience.

Join For Free

For my upcoming presentation “ASP.NET Core on Linux” I need Linux VM I can access with a remote desktop to run Visual Studio Code. After hours of many different problems that built up fast over my head I was able to make things work and now I have functioning VM I can use for demos. This post is a short overview about how I did what I did and is for readers who also want to have Linux VM with Visual Studio Code.

This post focuses on how to set up a virtualized Linux environment for Visual Studio Code. I got everything running with Kubuntu after a bit of struggling. Why Kubuntu? Here’s my long saga in short:

  • RDC connection is way more user-friendly than Hyper-V window or some VNC window
  • works okay but not with Gnome desktop
  • xrdp works okay with xfce but Visual Studio Code has issues with it
  • Installing K on Ubuntu with Gnome ended up with errors and crashes

NB! I’m very sure I did something wrong or had not enough knowledge and skills for more complex configuring of Linux environment. If you know more or you have a friend who is a Linux guru then you can perhaps use some other setup of a Linux environment. I’m just a happy n00bie here!

Image title

Installing Kubuntu

Let’s start with creating our Hyper-V virtual machine. To save time it’s a good idea to start the Kubuntu download before it. I created a VM with the following properties:

  1. No secure boot enabled
  2. 2 virtual cores
  3. 2048 MB RAM
  4. Network switch with access to local network
  5. 15GB HDD
  6. DVD-ROM

I attached a Kubuntu image as a DVD, ran Kubuntu, and opened VM in the Hyper-V window. Installation is actually easy – it’s just stepping through some dialogs and inserting user account information in the end. Installation went pretty fast – had time for one quick coffee and cigarette. After installation, Kubuntu required installation media to be removed and VM to be restarted. If there were no issues then Kubuntu is ready to go.

Installing and Configuring xrdp

As a next step, I made remote access work. It was a simple process too.

  1. Open terminal and install Krfb:
         sudo apt-get install Krfb 
  2. Run Krfb and configure remote access like described in official documentation page Using Desktop Sharing
  3. Install xrdp:
         sudo apt-get install xrdp 
         sudo system restart xrdp  
  4. Try to access VM using RDC from Windows box.

Installing .NET Core and Visual Studio Code

I installed .NET Core and Visual Studio Code.

  1. There is a problem with libicu55 library that must be installed manually. For this, follow the steps provided by Shannon Deminick’s post Installing .NET Core 1.01 on Ubuntu 16.10.
  2. Open terminal window and type the following commands (more information is available on .NET Core homepage):
        sudo sh -c ‘echo “deb [arch=amd64] https://apt-mo.trafficmanager.net/repos/dotnet-release/ xenial main” > /etc/apt/sources.list.d/dotnetdev.list’
        sudo apt-key adv –keyserver apt-mo.trafficmanager.net –recv-keys 417A0893
        sudo apt-get update
        sudo apt-get install dotnet-dev-1.0.0-preview2-003131
  3. Open browser, got VS Code homepage, and download Ubuntu package. Make sure you save it on the hard disk.
  4. In terminal window move to folder where VS Code was downloaded and run the following command:
        sudo dpkg -i vs-code-deb-file-name-here.deb
  5. Install Git using the following command:
        sudo apt-get install git

If there were no errors then Visual Studio Code should start with no issues when logged in using Remote Desktop.

Wrapping Up

It was easy to get everything to work once I figured out what the problem was. But figuring this out takes a lot of time if you're not familiar with Linux. Once everything works it's easy enough to make more configuration changes. Actually, Linux works just fine and for Windows dudes, it’s more of a question about figuring which things work together. Anyway, my environment for ASP.NET of Linux presentation is now ready to go.

Linux (operating system) .NET Visual Studio Code workplace Hyper-V

Published at DZone with permission of Gunnar Peipman, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

Popular on DZone

  • Unleashing the Power of JavaScript Modules: A Beginner’s Guide
  • Unlocking the Power of Polymorphism in JavaScript: A Deep Dive
  • Spring Boot Docker Best Practices
  • Promises, Thenables, and Lazy-Evaluation: What, Why, How

Comments

Partner Resources

X

ABOUT US

  • About DZone
  • Send feedback
  • Careers
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 600 Park Offices Drive
  • Suite 300
  • Durham, NC 27709
  • support@dzone.com
  • +1 (919) 678-0300

Let's be friends: