Google team comes with this intro for Google Shell:
When you start Cloud Shell, it provisions a e2-small Google Compute Engine virtual machine running a Debian-based Linux operating system. Cloud Shell instances are provisioned on a per-user, per-session basis. The instance persists while your Cloud Shell session is active; after an hour of inactivity, your session terminates and its VM, discarded. For more on usage quotas, refer to the limitations guide.
The tutorial for today solve this simple issue: use Google Shell to create and run a C# project;
Let’s start with this Google webpage.
You can see all your projects.
Google uses some notations into command output.
For example, this PROJECT_ID refers to your project identification.
I will use in the same way these notations to see how these changes appear:

Open your Cloud Shell console by selecting this icon from the top of the open webpage:

You can see in the bottom of this webpage a console interface with this message:

Let’s run the first command to show information about your accounts: gcloud auth list

The next command will set your project, where the PROJECT_ID is your project id: gcloud config set project PROJECT_ID

You can get info about the project with this command: gcloud config list project

You can unset the project with this command: gcloud config unset project

In this case, when you will run gcloud config list project command you will get an error:

Let’s set again.

The next step is to enable the Cloud Run API from Cloud Shell:

To enable billing account you need to follow these steps from the Google webpage.
Now, I can enable it:

I use dotnet command-line tool in Cloud Shell to create the first cloud project named charp_cloud_001.

Let’s go to the folder I created to see the project files:

These default project source code can be view with an editor tool.
I use the vim tool to see the Program.cs file:

The next C# source code is from Startup.cs file:

Now I can add and change these and other C# files to finish my project.
I f you run these source code with dotnet watch run or dotnet run commands you will get warn error.
I can see on my browser the Hello World! when I click on the output of the dotnet watch run command:

This open in my browser a link like this: https://5000-x_____.europe-west4.cloudshell.dev/?authuser=0&environment_name=default
Another simple issue for this tutorial is the tools used on Cloud Shell:
If you don’t like the great vim editor, then you can use the Open Editor button.
Also, you can use mc command to open it and use it, see the next screenshot:

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.