Skip to content

atiq-cs/net-core-google-cloud

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Google Cloud Platform Demos using .net core

A few Google Cloud Platform APIs are demonstrated using .Net Core in this repository. Google Cloud Platform has a long list of API can be further viewed here.

Project Descriptions

There are 4 projects under this directory.

Each of the project (links above) contains a readme file that provide explanations/details on the project.

To run any of these google cloud projects we have to set the environment variable GOOGLE_APPLICATION_CREDENTIALS; cloud.google.com Authentication docs - Setting the environment variable provides documentation on this. On powershell, this is how we set this variable to point to the location of json file,

$Env:GOOGLE_APPLICATION_CREDENTIALS = 'D:\GCloud-Code\baynet-5d3100fe31x.json'

Of course, first, we have to create a project using Google Cloud Console. Then, we download json which contains credential for google cloud platform account.

JsonDumper (dump)

3 projects depend on dump project. In each of them following command should be applied to add reference,

$ dotnet add reference ..\dump\dump.csproj
Reference `..\dump\dump.csproj` added to the project.

to use JsonDumper. Addition the project directory also contains instruction how to build it.

While 3 projects are EXE console application projects, dump is a class library project.

Instructions for building dump project

Create class library project,

$ dotnet new classlib -n dump
$ cd dump
$ Rename-Item Program.cs JsonDumper.cs

Add required deps,

$ dotnet add package Google.Protobuf
  Writing C:\Users\atiqc\AppData\Local\Temp\tmp1CED.tmp
info : Adding PackageReference for package 'Google.Protobuf' into project 'D:\baynet\dump\dump.csproj'.
log  : Restoring packages for D:\baynet\dump\dump.csproj...
info :   CACHE https://api.nuget.org/v3-flatcontainer/google.protobuf/index.json
info : Package 'Google.Protobuf' is compatible with all the specified frameworks in project 'D:\baynet\dump\dump.csproj'.
info : PackageReference for package 'Google.Protobuf' version '3.6.0' added to file 'D:\baynet\dump\dump.csproj'.

$ dotnet add package Newtonsoft.Json
  Writing C:\Users\atiqc\AppData\Local\Temp\tmp36AF.tmp
info : Adding PackageReference for package 'Newtonsoft.Json' into project 'D:\baynet\dump\dump.csproj'.
log  : Restoring packages for D:\baynet\dump\dump.csproj...
info :   CACHE https://api.nuget.org/v3-flatcontainer/newtonsoft.json/index.json
info : Package 'Newtonsoft.Json' is compatible with all the specified frameworks in project 'D:\baynet\dump\dump.csproj'.
info : PackageReference for package 'Newtonsoft.Json' version '11.0.2' added to file 'D:\baynet\dump\dump.csproj'.

Let's build,

$ dotnet build
Microsoft (R) Build Engine version 15.7.179.6572 for .NET Core
Copyright (C) Microsoft Corporation. All rights reserved.

  Restoring packages for D:\baynet\dump\dump.csproj...
  Restore completed in 127.98 ms for D:\baynet\dump\dump.csproj.
  dump -> D:\baynet\dump\bin\Debug\netstandard2.0\dump.dll

Build succeeded.
    0 Warning(s)
    0 Error(s)

Time Elapsed 00:00:01.44

These demos are based on demo source-code provided by Jeffrey Rennie at Google during South Bay .Net Google Cloud Platform event.

Also came as minor note, Google has added Kotlin to official language list; acquired kaggle and rewriting it in their official language stacks.

For who wanna have brief note at .net core intro: .NET Standard - Demystifying .NET Core and .NET Standard - Immo Landwerth. Feel free to reach me, atiqcs 'at' outlook 'dot' com if you encounter any issue while building these demos.