This page shows you how to configure Microsoft Visual Studio and create and deploy an ASP.NET application on Google Cloud.
Before you begin
In the Google Cloud Console, on the project selector page, click Create to begin creating a new Google Cloud project.
Make sure that billing is enabled for your Cloud project. Learn how to confirm that billing is enabled for your project.
- Ensure you have the following software installed on your local system:
- Visual Studio 2019 or Visual Studio 2017, any Windows edition. (Cloud Tools for Visual Studio does not support Visual Studio 2017 for Mac.)
- Cloud SDK
- Navigate to the ASP.NET Framework image on the Google Cloud Marketplace.
Go to the ASP.NET Framework image
- Select Launch on Compute Engine.
- Choose your Deployment name and settings, ensuring that Allow HTTP Traffic and Allow WebDeploy Traffic are checked.
- Select Deploy.
Installing Cloud Tools for Visual Studio
To install Cloud Tools for Visual Studio from the Extensions and Updates dialog in Visual Studio:
- Select Tools > Extensions and Updates.
- Select the Online facet from the left pane.
- Search for Google Cloud Tools for Visual Studio.
- Click Download and follow the prompts.
- 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.
- Open Visual Studio.
- Launch Cloud Explorer by selecting Tools > Google Cloud Tools > Show Google Cloud Explorer.
- Click Select or create account.
- Click Add account.
- Select the account to use for your application.
- Click Allow and close the browser window.
A new browser window opens and asks for the permissions it needs to manage your Google Cloud resources.
Selecting a project
To select a Google Cloud project to deploy your application to:
- In the Cloud Explorer, click Select Project.
- Select your project in the list.
- 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:
- Choose File > New > Project to open the New Project dialog.
- Use the left panel to navigate to Installed > Visual C# > Google Cloud Platform.
- Select ASP.NET on Google Cloud Platform.
- Enter the Name of your project.
- Click OK.
- Select the Template type.
- Click OK.
- Build the solution and run it locally, verifying that it works.
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.
Deploying an ASP.NET app
To deploy your ASP.NET app to a Windows VM running on Compute Engine:
- In Cloud Explorer, select the newly created project and expand GKE.
- Right-click on the VM instance that you created above with Cloud Marketplace.
- Select Manage Windows credentials.
- Click Add credentials.
- Enter a username.
- Ensure that Create a password for me is selected and click Save.
- Click Reset when prompted with the confirmation question: "Reset the password for [your username] on the instance [instance you created]?"
- Then click the Close button to close the password window.
- Next click the Close button to close the Windows Credentials window.
- In the Visual Studio Solution Explorer pane, right click your application.
- In the context menu, click Publish to Google Cloud...
- In the Publish dialog box, choose Compute Engine.
- Click Publish to build and deploy the sample application.
After publishing completes, Visual Studio opens the application in your
default web browser:
That's it — your application is hosted on Compute Engine.