Overview of .NET on Google Cloud Platform

I consider myself a Java developer first but during my time at Microsoft and Skype, I had the chance to learn about C# and .NET. Over time, I started liking the advanced features in C# (that Java just recently started having) and the great ecosystem and tooling around .NET. 

When I moved to Google and started working on Google Cloud Platform, I was naturally very happy to learn that Google Cloud Platform supports .NET applications.

In this blog post, I want to provide an overview of .NET support on Google Cloud Platform and talk about .NET client library. 

If you want more details, .NET on Google Cloud Platform is the best page to get started, it includes quickstarts, code samples, tutorials and more.

Windows Server and ASP.NET

First question you probably have is: What kind of .NET applications can I host on Google Cloud and how? You can host ASP.NET applications on Windows Server running on Compute Engine.

The easiest way to get started is to use Cloud Launcher ASP.NET Framework to deploy Windows Server 2012, Microsoft IIS, ASP.NET, and SQL Express on a Compute Engine instance.

Once the ASP.NET stack is installed, ASP.NET apps can be deployed from Visual Studio using the regular Web Deployer (no special plugin needed) to your Compute Engine instance.

.NET on Google Cloud Platform page includes a Hello World with .NET sample on details on how to deploy .NET apps on Google Cloud. There is also a How to get your ASP.NET app up on Google Cloud the easy way post on Google Cloud Platform blog that you might find useful.

.NET Library for Google Cloud Platform

Once you have your basic ASP.NET app running, you probably want to know what .NET APIs and libraries exist for which part of Google Cloud Platform. 

Currently, there are 2 different .NET libraries for Google Cloud Platform: Google API Client Library for .NET and Google Cloud Platform Client Libraries for .NET. The latter libraries are currently in Alpha and Beta stages, so I won’t talk about them in detail here but stay tuned for more details in a future post.

Google API Client Library for .NET is currently the official library for many Google services, including Google Cloud Platform. It includes .NET APIs for many Google Cloud services such as Cloud Storage, BigQuery, Pub/Sub, Dataflow and more. The full list is on their APIs page (search for “cloud” for Google Cloud related APIs).

Main APIs

I want to outline some of the main .NET APIs for storing data, messaging, BigQuery and point to their NuGet packages and source code for easy reference.

Structured Data

Every application needs some kind of structured data and you have 2 options to store structured application data:

  1. Google Cloud SQL can be used with regular Entity Framework (no special API needed).
  2. Google Cloud Datastore (NoSQL) can be used with Google Cloud Datastore API Client Library for .NET (NuGet | Source).

Binary Data

You can use Google Cloud Storage to store binary data with Cloud Storage JSON API Client Library for .NET (NuGet | Source).

Messaging

You can use Google Cloud Pub/Sub for publish/subscribe messaging with Google Cloud Pub/Sub API Client Library for .NET (NuGet | Source).

BigQuery

You can work with Google Cloud BigQuery with BigQuery API Client Library for .NET (NuGet | Source).

Other APIs

For the rest of Google Cloud Platform, you can find APIs on Google Compute Engine, Google DataFlow, Google Cloud Dataproc and many more under APIs section of Google API Client Library for .NET.

Code Samples

There is also a GitHub repository called dotnet-doc-samples where more and more samples are being added for .NET on Google Cloud Platform.

As you can see, .NET is a fully supported framework and it’s only going to get better, so I’m very excited to see how .NET support will evolve going forward on Google Cloud Platform.

 

Mintty Weirdness

I use Cygwin to emulate a Unix-like terminal on Windows. Even though Cygwin is pretty good in emulating Unix terminal, its UI leaves a lot to be desired for, so I decided to use Mintty on top of Cygwin. Mintty not only looks nicer than Cygwin but it also has some useful features like easy copy/paste, drop & drop of text files and so on.

I installed Mintty through the usual Cygwin package installation process and I saw that it put mintty.exe file under cygwin’s bin folder. When I tried to run Mintty by invoking mintty.exe from Cygwin, it worked fine. Pretty soon, I was changing the terminal properties and making Mintty look like I wanted. So far so good.

The problem started when I created a shortcut to launch Mintty from Windows Start page. I wanted this shortcut to launch Mintty on Cygwin by default. When I clicked on the shortcut, none of the normal Unix commands would work, I would get a “command not found” error from bash. After Googling for a while and some random experiments, I found out that I had to go to shortcut’s properties and change its target to add a dash at the end. So my shortcut’s target is “C:\cygwin64\bin\mintty.exe -”

Don’t know or care why I have to do this but I wish developers put more thought in the first time use experience of their applications/libraries/packages.