This page shows you how to configure Microsoft Visual Studio and create and deploy an ASP.NET application on Google Cloud.

Before you begin

  1. In the Google Cloud Console, on the project selector page, click Create project to begin creating a new Google Cloud project.

    Go to project selector

  2. Make sure that billing is enabled for your Cloud project. Learn how to confirm that billing is enabled for your project.

  3. Ensure you have the following software installed on your local system:
  4. Create a new Windows VM to host your app:
    1. Navigate to the ASP.NET Framework image on the Google Cloud Marketplace.
      Go to the ASP.NET Framework image
    2. Select Launch on Compute Engine.
    3. Choose your Deployment name and settings, ensuring that Allow HTTP Traffic and Allow WebDeploy Traffic are checked.
    4. Select Deploy.

Installing Cloud Tools for Visual Studio

To install Cloud Tools for Visual Studio from the Extensions and Updates dialog in Visual Studio:

  1. Select Tools > Extensions and Updates.
  2. Select the Online facet from the left pane.
  3. Search for Google Cloud Tools for Visual Studio.
  4. Screenshot showing the Extensions and Updates dialog. The left
             panel shows extension sources organized in tabs. The center panel
             shows the entries in the tabs, and the right panel provides details
             about the current selection. The Google Cloud Tools for Visual Studio option
             is selected.

  5. Click Download and follow the prompts.
  6. Restart Visual Studio to load the extension.

Signing in to Google

Sign in to a Google account that you use to deploy your project to App Engine.

  1. Open Visual Studio.
  2. Launch Cloud Explorer by selecting Tools > Google Cloud Tools > Show Google Cloud Explorer.
  3. Screenshot showing the Cloud Explorer with the Select or
           create account link.

  4. Click Select or create account.
  5. Click Add account.
  6. A new browser window opens and asks for the permissions it needs to manage your Google Cloud resources.

  7. Select the account to use for your application.
  8. Click Allow and close the browser window.

Selecting a project

To select a Google Cloud project to deploy your application to:

  1. In the Cloud Explorer, click Select Project.
  2. Select your project in the list.
  3. Screenshot showing the select Google Cloud project dialog with a
           single project shown.

  4. Click OK.

The Cloud Explorer refreshes and displays the resources for the selected project.

Creating an ASP.NET app

To create a new ASP.NET project and run it locally:

  1. Choose File > New > Project to open the New Project dialog.
  2. The New Project dialog. On the left, it displays the available
                project types, with Google Cloud selected. The center
                shows the available templates, with ASP.NET on Google Cloud
                selected. It also shows the fields for entering the project
                name, location, and solution name.

  3. Use the left panel to navigate to Installed > Visual C# > Google Cloud Platform.
  4. Select ASP.NET on Google Cloud Platform.
  5. To deploy your app to a VM on Compute Engine, target the .NET Framework, not .NET Core. Use the ASP.NET Core on Google Cloud Platform template for GKE or App Engine.

  6. Enter the Name of your project.
  7. Click OK.
  8. Dialog to select the target framework for the new project. There
                are 2 drop downs for the target framework selection, a Google
                Cloud Project ID selector, and 2 radio buttons.

  9. Select the Template type.
  10. Click OK.
  11. Build the solution and run it locally, verifying that it works.

Deploying an ASP.NET app

To deploy your ASP.NET app to a Windows VM running on Compute Engine:

  1. In Cloud Explorer, select the newly created project and expand GKE.
  2. Right-click on the VM instance that you created above with Cloud Marketplace.
  3. Select Manage Windows credentials.

    Manage Accounts

  4. Click Add credentials.
  5. Enter a username.
  6. Ensure that Create a password for me is selected and click Save.
  7. Click Reset when prompted with the confirmation question: "Reset the password for [your username] on the instance [instance you created]?"
  8. Then click the Close button to close the password window.
  9. Next click the Close button to close the Windows Credentials window.
  10. In the Visual Studio Solution Explorer pane, right click your application.
  11. In the context menu, click Publish to Google Cloud

    Publish to Google Cloud

  12. In the Publish dialog box, choose Compute Engine.

    Choose to publish to Compute Engine

  13. Click Publish to build and deploy the sample application. After publishing completes, Visual Studio opens the application in your default web browser:

    Test application

That's it — your application is hosted on Compute Engine.

What's next