Which Azure Table Storage .NET SDK should I use?

When working with Azure Table Storage (ATS) in C# / .NET there are currently at least four NuGet packages offered by Microsoft for working with tables. It gets even more complicated as there’s an Azure.Storage SDK (currently in Version 12) that works with all Azure Storage Account related services — except Table Storage. Additionally Microsoft mostly talks about the CosmosDB Table API, but all libraries also work with the regular ATS since the APIs are identical.

So what are our options and which one should I choose?

Continue reading Which Azure Table Storage .NET SDK should I use?

Building & Publishing .NET Standard Nuget Packages in VSTS

A while ago I started building a C# Wrapper (WordPressPCL) for the new WordPress REST API that was released in version 4.7. At first it was a regular Portable Class Library (hence the name), but with the release of .NET Standard I quickly switched to this new format which is more compatible and easier to understand. If you’re new to .NET Standard, check out these great introduction videos by Immo Landwerth.

Since I’m getting more and more pull requests for this project I decided to automate the build & publishing process using Microsofts pretty great Visual Studio Team Services. If you haven’t checked them out, I highly recommend taking a closer look. Everything I’m doing here is completely free since my team is smaller than 5 people (1 < 5).

So the basic idea is:

  • Get the code from GitHub
  • Build the .dll using Visual Studio
  • Create a NuGet package
  • publish it to the public nuget.org feed

I wont set up continuous integration since I want full control and not have packages published by accident. So I’ll still have to trigger the process manually, which is fine in this case. That also means I don’t care about automatic versioning for now and will just update the package version manually as well before checking in my code. Check out this great blog post by Ben Chartrand if you’re interested in automatically incrementing the version number.

Step 0: Set up project to build NuGet package

Before we start creating the build chain, go into Visual Studio 2017 (any edition will do) and open up your project properties. Go to the Package tab and make sure to select the Generate NuGet package on build option. Fill out the rest of the fields as well. This information will be used to create the NuGet Specs for your package. Check in your code.

Create NuGet Package in Visual Studio 2017

Step 1: Create Build Definition

Create new VSTS Build Definition

We create a new build definition using the standard Visual Studio template. We can remove a lot of the build steps immediately (see second image), but this will give us a nice starting point.

Step 2: Get the code

Get source code from GitHub

You can get your source code from VSTS, GitHub or any Git repository you like. Unfortunately the GitHub connector does not yet support repos from an organization so I had to manually set up the access to my GitHub repository.

Step 3: Setup NuGet restore

Next we need to make sure that we’re using NuGet Version 4.0.0 so the packages can be restored without any issues.

Step 4: Configure Build solution step

Configure Build Step in VSTS

To have my package build without issues, I had to switch change the Solution-field from the wildcard **\*.sln to my actual .csproj-path, so WordPressPCL\WordPressPCL.csproj. To change the value, you’ll need to unlink the solution first.

Step 5: NuGet Publisher

Configure NuGet Publisher Step

Now for the interesting part. Add the NuGet Publisher task to your queue. We don’t need the NuGet Packager since Visual Studio already built that package for us.
Here we have to set the NuGet Server Endpoint, which we’ll need to add to our list of Endpoints first by hitting the small cog next to the input field.
Click on New Service Endpoint -> Generic, give it a name, https://nuget.org/ as the Server URL and enter your nuget.org Username.
Then, go to nuget.org/account and create a new API key to use as the Password/Token Key.
After saving those settings you can go back to your NuGet Publisher step and select the newly created Endpoint from the dropdown menu. Under Advanced, select NuGet Version 4.0.0.

And that’s it. Your .NET Standard library should now be built as a NuGet Package and published to the public nuget.org feed.

.NET Standard Nuget Packages in VSTS builden & auf nuget.org veröffentlichen

Vor einiger Zeit habe ich damit begonnen, einen C# Wrapper (WordPressPCL) für die neue WordPress REST API (verfügbar seit Version 4.7) zu schreiben. Zunächst war das ganze als normale Portable Class Library geplant (daher auch der Name). Mit der Veröffentlichung von .NET Standard habe das Projekt hierauf umgestellt. Eine super Einleitung in dieses Thema gibt es auf YouTube von Immo Landwerth.

Nachdem das Projekt in letzter Zeit vermehrt Pull Requests erhält, habe ich mich entschieden, den Build & Publish Prozess zu automatisieren, um nicht immer manuell die neuste Version des NuGet-Packages hochladen zu müssen. Hierfür nutze ich die kostenlosen Visual Studio Team Services.

Continue reading .NET Standard Nuget Packages in VSTS builden & auf nuget.org veröffentlichen