Use Of Visual Studio Code



-->

  1. Use Debugger Of Visual Studio Code
  2. Use Visual Studio Code For Javascript
  3. Use Visual Studio Code Debugger

Visual Studio Code does not have the concept of a known 'web application port' like Visual Studio for project types such as ASP.NET. However, if you are joining a collaboration session from a Visual Studio host, you may automatically see your default browser appear when debugging starts that is then automatically connected to the host's running. Visual Studio Code is a cross-platform script editor by Microsoft. Together with the PowerShell extension, it provides a rich and interactive script editing experience, making it easier to write reliable PowerShell scripts. Visual Studio Code with the PowerShell extension is the recommended editor for writing PowerShell scripts. On the left hand side of Visual Studio code, click the Find and Replace menu. Search for orgName. In the first result found in project-scratch-def.json. Change the orgName value (after the: and in between the “”) to Learning VS Code. Save the file by pressing Command + S on Mac, Control + S on Windows.

Learn how to install and run scripts using the Azure Machine Learning Visual Studio Code extension.

In this tutorial, you learn the following tasks:

  • Install the Azure Machine Learning Visual Studio Code extension
  • Sign into your Azure account from Visual Studio Code
  • Use the Azure Machine Learning extension to run a sample script

Prerequisites

  1. Build, manage, and deploy containerized applications using the Docker extension. Generate Docker files from your existing repository and manage your containers, images,.
  2. The following steps illustrate how to download and install the Syncfusion Blazor Template Studio with the Code Generator extension from the Visual Studio Marketplace. Note: Syncfusion Blazor Code Generator was shipped within the Syncfusion Template Studio. Download the Syncfusion Blazor Template Studio from the Visual Studio Marketplace.

Use Debugger Of Visual Studio Code

  • Azure subscription. If you don't have one, sign up to try the free or paid version of Azure Machine Learning.
  • Visual Studio Code. If you don't have it, install it.

Install the extension

  1. Open Visual Studio Code.

  2. Select Extensions icon from the Activity Bar to open the Extensions view.

  3. In the Extensions view, search for 'Azure Machine Learning'.

  4. Select Install.

Note

Alternatively, you can install the Azure Machine Learning extension via the Visual Studio Marketplace by downloading the installer directly.

The rest of the steps in this tutorial have been tested with version 0.6.8 of the extension.

Sign in to your Azure Account

In order to provision resources and run workloads on Azure, you have to sign in with your Azure account credentials. To assist with account management, Azure Machine Learning automatically installs the Azure Account extension. Visit the following site to learn more about the Azure Account extension.

  1. Open the command palette by selecting View > Command Palette from the menu bar.
  2. Enter the command 'Azure: Sign In' into the command palette to start the sign in process.
Visual studio code tutorial

Run a machine learning model training script in Azure

Now that you have signed into Azure with your account credentials, Use the steps in this section to learn how to use the extension to train a machine learning model.

  1. Download and unzip the VS Code Tools for AI repository anywhere on your computer.

  2. Open the mnist-vscode-docs-sample directory in Visual Studio Code.

  3. Select the Azure icon in the Activity Bar.

  4. Select the Run Experiment icon at the top of the Azure Machine Learning View.

  5. When the command palette expands, follow the prompts.

    Note

    If you already have existing Azure Machine Learning resources provisioned, see how to run experiments in VS Code guide.

    1. Select your Azure subscription.
    2. From the list of environments, select Conda dependencies file.
    3. Press Enter to browse the Conda dependencies file. This file contains the dependencies required to run your script. In this case, the dependencies file is the env.yml file inside the mnist-vscode-docs-sample directory.
    4. Press Enter to browse the training script file. This is the file that contains code to a machine learning model that categorize images of handwritten digits. In this case, the script to train the model is the train.py file inside the mnist-vscode-docs-sample directory.
  6. At this point, a configuration file similar to the one below appears in the text editor. The configuration contains the information required to run the training job like the file that contains the code to train the model and any Python dependencies specified in the previous step.

  7. Once you're satisfied with your configuration, submit your experiment by opening the command palette and entering the following command:

    This sends the train.py and configuration file to your Azure Machine Learning workspace. The training job is then started on a compute resource in Azure.

Track the progress of the training script

Running your script can take several minutes. To track its progress:

  1. Select the Azure icon from the activity bar.

  2. Expand your subscription node.

  3. Expand your currently running experiment's node. This is located inside the {workspace}/Experiments/{experiment} node where the values for your workspace and experiment are the same as the properties defined in the configuration file.

  4. All of the runs for the experiment are listed, as well as their status. To get the most recent status, click the refresh icon at the top of the Azure Machine Learning View.

Download the trained model

When the experiment run is complete, the output is a trained model. To download the outputs locally:

Use
  1. Right-click the most recent run and select Download Outputs.

  2. Select a location where to save the outputs to.

  3. A folder with the name of your run is downloaded locally. Navigate to it.

  4. The model files are inside the outputs/outputs/model directory.

Next steps

  • Tutorial: Train and deploy an image classification TensorFlow model using the Azure Machine Learning Visual Studio Code Extension.
-->

Visual Studio Code, along with the Remote - WSL extension, enables you to use WSL as your full-time development environment directly from VS Code. You can:

  • develop in a Linux-based environment
  • use Linux-specific toolchains and utilities
  • run and debug your Linux-based applications from the comfort of Windows while maintaining access to productivity tools like Outlook and Office
  • use the VS Code built-in terminal to run your Linux distribution of choice
  • take advantage of VS Code features like Intellisense code completion, linting, debug support, code snippets, and unit testing
  • easily manage your version control with VS Code's built-in Git support
  • run commands and VS Code extensions directly on your WSL projects
  • edit files in your Linux or mounted Windows filesystem (for example /mnt/c) without worrying about pathing issues, binary compatibility, or other cross-OS challenges

Install VS Code and the Remote WSL extension

  • Visit the VS Code install page and select the 32 or 64 bit installer. Install Visual Studio Code on Windows (not in your WSL file system).

  • When prompted to Select Additional Tasks during installation, be sure to check the Add to PATH option so you can easily open a folder in WSL using the code command.

  • Install the Remote Development extension pack. This extension pack includes the Remote - WSL extension, in addition to the Remote - SSH, and Remote - Containers extensions, enabling you to open any folder in a container, on a remote machine, or in WSL.

Important

In order to install the Remote-WSL extension, you will need the 1.35 May release version or later of VS Code. We do not recommend using WSL in VS Code without the Remote-WSL extension as you will lose support for auto-complete, debugging, linting, etc. Fun fact: this WSL extension is installed in $HOME/.vscode/extensions (enter the command ls $HOME.vscodeextensions in PowerShell).

Update your Linux distribution

Some WSL Linux distributions are lacking libraries that are required by the VS Code server to start up. You can add additional libraries into your Linux distribution by using its package manager.

For example, to update Debian or Ubuntu, use:

To add wget (to retrieve content from web servers) and ca-certificates (to allow SSL-based applications to check for the authenticity of SSL connections), enter:

Open a WSL project in Visual Studio Code

From the command-line

To open a project from your WSL distribution, open the distribution's command line and enter: code .

From VS Code

You can also access more VS Code Remote options by using the shortcut: CTRL+SHIFT+P in VS Code to bring up the command palette. If you then type Remote-WSL you will see a list of the VS Code Remote options available, allowing you to reopen the folder in a remote session, specify which distribution you want to open in, and more.

Extensions inside of VS Code Remote

The Remote-WSL extension splits VS Code into a “client-server” architecture, with the client (the user interface) running on your Windows machine and the server (your code, Git, plugins, etc) running remotely.

When running VS Code Remote, selecting the 'Extensions' tab will display a list of extensions split between your local machine and your WSL distribution.

Use Visual Studio Code For Javascript

Installing a local extension, like a theme, only needs to be installed once.

Some extensions, like the Python extension or anything that handles things like linting or debugging, must be installed separately on each remote WSL distributions. VS Code will display a warning icon ⚠, along with a green 'Install in WSL' button, if you have an extension locally installed that is not installed on your WSL Remote.

Use Of Visual Studio Code

For further information, see the VS Code docs:

  • When VS Code Remote is started in WSL, no shell startup scripts are run. See this advanced environment setup script article for more info on how to run additional commands or modify the environment.

  • Having problems launching VS Code from your WSL command line? This troubleshooting guide includes tips on changing path variables, resolving extension errors about missing dependencies, resolving Git line ending issues, installing a local VSIX on a remote machine, launching a browser window, blocker localhost port, web sockets not working, errors storing extension data, and more.

Install Git (optional)

If you plan to collaborate with others, or host your project on an open-source site (like GitHub), VS Code supports version control with Git. The Source Control tab in VS Code tracks all of your changes and has common Git commands (add, commit, push, pull) built right into the UI.

To install Git, see set up Git to work with Windows Subsystem for Linux.

Install Windows Terminal (optional)

The new Windows Terminal enables multiple tabs (quickly switch between Command Prompt, PowerShell, or multiple Linux distributions), custom key bindings (create your own shortcut keys for opening or closing tabs, copy+paste, etc.), emojis ☺, and custom themes (color schemes, font styles and sizes, background image/blur/transparency). Learn more in the Windows Terminal docs.

Use Visual Studio Code Debugger

  1. Get Windows Terminal in the Microsoft Store: By installing via the store, updates are handled automatically.

  2. Once installed, open Windows Terminal and select Settings to customize your terminal using the profile.json file.

Additional Resources

A few additional extensions you may want to consider include:

  • Keymaps from other editors: These extensions can help your environment feel right at home if you're transitioning from another text editor (like Atom, Sublime, Vim, eMacs, Notepad++, etc).
  • Settings Sync: Enables you to synchronize your VS Code settings across different installations using GitHub. If you work on different machines, this helps keep your environment consistent across them.
  • Debugger for Chrome: Once you finish developing on the server side with Linux, you'll need to develop and test the client side. This extension integrates your VS Code editor with your Chrome browser debugging service, making things a bit more efficient.