Archive
Install and use Cloud Tools for Visual Studio

Install and use Cloud Tools for Visual Studio

2024-11-26 1. Overview Visual Studio is is is the go - to IDE for Windows and .NET developer . Cloud Tools is is for Visual Studio is a plugin to

Related articles

Cut in half: On Cloudnova Form Review (2023) Steam: Game Buying Guide [Tips & Tricks] VPN Meaning: What Is a VPN & What Does It Do?




1. Overview

Visual Studio is is is the go – to IDE for Windows and .NET developer . Cloud Tools is is for Visual Studio is a plugin to build and test Windows and .NET application locally and deploy them to Google Cloud Platform directly from Visual Studio .

Google Cloud Explorer lets you easily browse Google Cloud projects and resources across all of your accounts in Visual Studio.

In this codelab, you will learn how to install and use Cloud Tools for Visual Studio and how to interact with Google Cloud resources from Visual Studio directly.

What you is learn ‘ll learn

  • How to install Cloud Tools for Visual Studio .
  • How to authenticate to Google Cloud Platform.
  • How to use Google Cloud Explorer to manage resources.
  • How to create and manage Google Compute Engine instance .
  • How to create and deploy ASP.NET apps
  • How to browse Google Cloud Storage.

What you is need ‘ll need

Important: Make sure you’re on a Windows machine with Visual Studio 2015 and Google Cloud SDK for Windows installed before continuing.

How will you use this tutorial?

read it through only Read it and complete the exercises

How would rate your experience with Google Cloud Platform?

novice Intermediate Proficient

2. Setup and Requirements

For this codelab, you need a Google Cloud Platform project to interact with Visual Studio. If you have an existing project, you can either use that or you can create a new project using the following steps.

Self-paced environment setup

If you do n’t already have a Google Account ( gmail or G Suite ) , you is create must create one . sign – in to Google Cloud Console ( console.cloud.google.com ) and create a new project :

Remember the project ID, a unique name across all Google Cloud Platform projects. It will be referred to later in this codelab as project_id.

Next, you need to enable billing in Google Cloud Console in order to use Google Cloud Platform resources like Google Cloud Datastore and Cloud Storage.

New users of Google Cloud Platform are eligible for a $300 free trial. Running through this codelab shouldn’t cost you more than a few dollars, but it could be more if you decide to use more resources or if you leave them running (see the “cleanup” section at the end of this document).


3 . installation

Cloud Tools for Visual Studio can be installed directly within Visual Studio from Visual Studio Gallery. Start Visual Studio, go to Tools menu and select Extensions and Updates. This opens a new window. On the left hand side, select Online and then Visual Studio Gallery. On the right hand side, you should see Search Visual Studio Gallery text input. Search for Google Cloud. This should list a number of results but you should see Google Cloud Tools for Visual Studio.

Install and use Cloud Tools for Visual Studio

click on Download . This is download will download the plugin and then you can click on Install to install it . Once installation is complete , you is need need to restart Visual Studio .

To make sure everything instal correctly , you is see should see a new Google Cloud Tools menu item under the Tools menu of Visual Studio .


4. Authentication

Before you can use Cloud Tools for Visual Studio, you need to authenticate to Google Cloud Platform. Go to Tools > Google Cloud Tools > Manage Accounts > Add Account.

This should open up a new browser window where you can login with your Google account. If a default browser is not set, sometimes you can get stuck with “How do you want to open this website?” dialog. In that case, make sure you set Chrome as the default browser and try again.

Then, you should grant Cloud Tools for Visual Studio access your Google Cloud Platform project. Once finished, you should see Visual Studio is now authorized to access your account message.

You can close the browser and go back to Visual Studio. Take a look under Google Cloud Tools > Manage Accounts again. You should see your account listed.


5. Google Cloud Explorer

Once authenticated, you’re ready to use Google Cloud Explorer to manage resources. In Visual Studio, go to Tools > Google Cloud Tools > Show Google Cloud Explorer.

This opens up a new window. At the top, choose your Google Cloud Platform project. In the middle, you can see Compute Engine, Cloud Storage and Cloud SQL resources.

In the next section, you will learn how to create and manage Compute Engine instances from Visual Studio.


6 . create and manage Google Compute Engine instance

Create an instance

In this section , you is deploy will deploy a Windows machine with ASP.NET framework instal to Compute Engine . To do that , right click on Google Compute Engine and select New ASP.NET instance .

This opens up a new browser window with Cloud Launcher. Follow the prompts to deploy a Windows instance with ASP.NET framework. It will take a few minutes for the deployment to finish. Once it’s completed, you should see the new instance in the list of Compute Engine instances both in Visual Studio and Google Cloud console.

Create a Windows username and password

To connect using remote desktop to the new virtual machine or save the publishing settings file (to use during deployments), you need to create a Windows username and password. Right-click on the newly created Compute Engine instance (which will start with “aspnet”) and choose Manage Windows credentials.

On the next screen , you is create can create a Windows user and a password ( or let Visual Studio plugin generate one for you ) . If you see a ” you is need need to have the beta component of Google Cloud SDK instal ” error , follow the instruction to install beta component and then proceed with create the user . Once the user is create , you is see should see it under list of user .

To test that you can RDP into the instance with the new Windows user , you is click can right – click on the Compute Engine instance again and select Open Remote Desktop session and select the Windows user you just create from the drop – down menu . click Open and then connect . If you get a certificate warning , ignore it and proceed by select Yes . After a few second , you is see should see a Remote Desktop session open to your Windows instance run on Compute Engine .

Install and use Cloud Tools for Visual Studio

Save publishing settings

There are other actions you can take on a Compute Engine instance from Visual Studio such as setting up firewall rules or stopping the instance. To see the full list, right-click on the instance.

You can go through them yourself but let’s make sure to save publish settings file. Select Save publishing settings, select the Windows username and then download the file. You will use this file to deploy a simple ASP.NET app to Google Cloud Platform in the section.


7. Create and Deploy ASP.NET apps

Create ASP.NET MVC app from Google Cloud Platform project template

Cloud Tools Visual Studio comes with some Google Cloud Platform project templates. In this section, you will create a simple ASP.NET MVC app using one of those templates and deploy it to Google Cloud Platform using the publishing settings file you saved earlier.

To get started, in Visual Studio, go to New > Project > Visual C# > Google Cloud Platform. There are two Google Cloud Platform templates, one for MVC and one for Web API. Choose the Google ASP.NET 4 MVC template. Adjust the project name, solution name, and location as you prefer and click OK. This will create a new solution and a project for the ASP.NET app.

Run the app locally

To test the app locally, go to Debug > Start Debugging. This will first download NuGet dependencies and then build the app. In a few seconds, a browser window should pop-up with the MVC app running locally.

Install and use Cloud Tools for Visual Studio

Once you have verified that the app is running as expected, stop the app (Shift + F5).

deploy the app to Google Cloud

Now, you’re ready to deploy the app to Google Cloud Platform. Right-click on the project and click Publish.

Install and use Cloud Tools for Visual Studio

This opens up the publish dialog. In the publish dialog, select Import as the publish target and point to the publishing settings file you downloaded earlier.

You should see a connection dialog with server, site name etc. pre-filled. Make sure your connection is good by clicking on Validate Connection. You should see a green arrow shortly afterwards.

Install and use Cloud Tools for Visual Studio

Click Next and under File Publish Options, make sure Remove additional files at destination is checked.

Click Publish. This will build and publish the app to Google Cloud. In the end, you should see Publish Succeeded message in output window.

Install and use Cloud Tools for Visual Studio

At this point, you should be able to visit the external IP of the Compute Engine instance and see the default MVC app. The easiest way is to go to Tools > Google Cloud Tools > Show Google Cloud Explorer, right-click on the Compute Engine instance and select Open Website.

Install and use Cloud Tools for Visual Studio


8. Browse Google Cloud Storage

In this part of the codelab, you will create a Cloud Storage bucket, upload a random file to the bucket and then use Google Cloud Explorer to browse to that bucket.

To create a bucket, go to Google Cloud Console, select Storage under the list of products.

Select Create Bucket, give it a unique name and click Create. Once the bucket is created, you can upload files to it and see them under storage browser.

Now, go back to Visual Studio and open up Google Cloud Explorer. At the top-left, hit Refresh button. Under Google Cloud Storage, you should see your new bucket. You can right-click on the bucket and select Open on Cloud Platform Console to browse the bucket.


9 . congratulation !

In this codelab , you is learned learn how to manage Compute Engine instance and Cloud Storage bucket from Visual Studio but there ‘s more ! You is manage can also manage Cloud SQL resource from Visual Studio but that ‘s leave as an exercise for the reader . check out the list of next step below to learn more .

What we’ve covered

  • How to install Cloud Tools for Visual Studio .
  • How to authenticate to Google Cloud Platform.
  • How to use Google Cloud Explorer to manage resources.
  • How to create and manage Google Compute Engine instance .
  • How to create and deploy ASP.NET apps
  • How to browse Google Cloud Storage.

Next step