Setting Up a .NET Development Environment

This tutorial shows how to prepare your local machine for developing .NET and .NET core applications that run on Google Cloud Platform and call Google Cloud Platform APIs.

Install a Development Environment

The recommended developer environment for running the .NET tutorials and sample applications in this documentation is Visual Studio 2017, or Visual Studio Code.

Create a Google Cloud Project

Create a Google Cloud Project for running your applications. Google Cloud Platform projects form the basis for creating, enabling, and using all Cloud Platform services.

Authentication

During local development, your .NET application must authenticate itself in order to interact with Google Cloud Platform APIs. The instructions below describe how to create a Service Account key for authenticating your application. Applications can use this method to authenticate locally and when deployed to Google Cloud Platform. Read more about authentication, including how authentication is handled once your application is deployed.

Create a Service Account key for authentication

  1. Visit the APIs & services dashboard and click Credentials.
    1. Click Create credentials and choose Service Account key.
    2. Under Service account, choose Compute Engine default service account, and leave JSON selected under Key Type. Click Create. A .json file will be downloaded to your computer.
    3. Set the environment variable GOOGLE_APPLICATION_CREDENTIALS to the path of the JSON key that was downloaded. In powershell, the commands are:

      For this powershell session.

      PS > $env:GOOGLE_APPLICATION_CREDENTIALS = "$env:USERPROFILE\Downloads\your-project-id-dea9fa230eae3.json"

      For all processes created after this command.

      PS > [Environment]::SetEnvironmentVariable("GOOGLE_APPLICATION_CREDENTIALS", "$env:USERPROFILE\Downloads\your-project-id-dea9fa230eae3.json", "User")

(Optional) Install .NET Tools and SDKs

Even though you can create and manage Google Cloud resources via your web browser using the Cloud Console, if you'd prefer to manage your Google Cloud resources from within Visual Studio or from the command-line, you should consider installing the following tools:

  • Cloud SDK

    The Cloud SDK is a command-line interface for Google Cloud Platform products and services.

  • Cloud Tools for Visual Studio

    Cloud Tools for Visual Studio enables development in Visual Studio on Google Cloud Platform.

  • Google Cloud Tools for PowerShell

    Google Cloud Tools for PowerShell is a set of cmdlets for Windows PowerShell that lets you manage Google Cloud Platform resources.

Next Steps

Was this page helpful? Let us know how we did:

Send feedback about...