Wednesday, March 22, 2017

Eventsourcing - One table with 3 columns, that’s all you need to build any kind of application

If you are new to EventSourcing I can recommend the eBay Tech Talk in Berlin, Raimo Radczewski did a great introduction about EventSourcing and CQRS.

Best quote during the talk:

One table with three columns; with EventSourcing, that’s all you need to develop an e-commerce system, a CRM app, or any kind of application you can imagine.

Tuesday, March 21, 2017

NPM Package.json publishing configuration

When managing your package.json file there are 2 use cases that can impact how you configure it:

I don't want my package published at all. It's private.

To enable this set "private": true in your package.json. This will prevent it from being published at all.

If you try to accidently publish the package, you’ll get the following feedback:

C:\projects\test\npmtest>npm publish
npm ERR! Windows_NT 10.0.10586
npm ERR! argv "C:\\Program Files (x86)\\nodejs\\node.exe" "C:\\Users\\BaWu\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js" "publish"
npm ERR! node v6.10.0
npm ERR! npm  v3.10.5

npm ERR! This package has been marked as private
npm ERR! Remove the 'private' field from the package.json to publish it.
npm ERR!
npm ERR! If you need help, you may report this error at:
npm ERR!     <>

npm ERR! Please include the following file with any support request:
npm ERR!     C:\projects\test\npmtest\npm-debug.log

I only want my package to be published to an internal registry.

Add a "publishConfig":{"registry":"http://my-internal-registry.local"} section to your package.json to force it to be published only to your internal registry.

Invoking the ‘npm publish’ command will publish the package to the specified registry.

More information at

Monday, March 20, 2017

ProGet: NPM connector returns no records

At a customer we are using ProGet as our internal package manager server. ProGet supports a lot of different package formats including NPM and NuGet. Thanks to the usage of connectors you can even link to other package sources like the official NuGet feed or the official NPM registry.

Unfortunately after creating an NPM feed and linking it to the official NPM registry( using a connector, the connector didn’t do anything and our feed remained empty.

Turns out that a scheduled task exists that indexes the Npm registry but it only runs once a week by default.

To find this scheduled task, go to your Proget site and click on the Administration icon image on the right


After logging in, go to Scheduled Tasks below System settings


In the list of Scheduled Tasks you should find the ‘FullNpmConnectorIndex’ task. You can invoke it immediatelly by clicking on the ‘Play’ button at the right.


Friday, March 17, 2017

Visual Studio 2017 Poster

The Microsoft team created a poster showing off some of their favorite parts of Visual Studio 2017. Time to get your A1 printer started and spice up your team room.


You can download the  PDF or check the web infographic version.

Thursday, March 16, 2017

Angular CLI - You have to be inside an angular-cli project in order to use the build command

After creating an Angular application using the following Angular CLI command;

ng new appname

You should open the newly created appname folder before invoking any other ng command. Otherwise you get the following error message:

You have to be inside an angular-cli project in order to use the <commandname> command

Unfortunately I got the same error after pulling an Angular project created by a colleague from our GIT repo. Although I was certainly in the correct folder, I saw the above error again Sad smile.

Turned out that the Angular project was created using a newer version of the Angular CLI. After updating to the latest version of the @angular/cli package the problem disappeared.

Remark: Here are the steps to correctly update Angular CLI:

Wednesday, March 15, 2017

Angular CLI–Error running ng-xi18n

Angular CLI is a great tool to help you during your daily Angular 2 development work. One of the features that is integrated is an internationalization(i18n) component that extracts XLF (or XMB) files that can be translated and used inside your Angular app.

However first time I tried to to use the ng-xi18n tool, it failed with the following error message

Error: Error encountered resolving symbol values statically. Function calls are not supported. Consider replacing the function or lambda with a reference to an exported function, resolving symbol AnimationDriver in C:/SampleApp/node_modules/@angular/platform-browser/src/dom/animation_driver.d.ts, resolving symbol BrowserTestingModule in C:/SampleApp/node_modules/@angular/platform-browser/testing/browser.d.ts, resolving symbol BrowserTestingModule in C:/SampleApp/node_modules/@angular/platform-browser/testing/browser.d.ts

    at simplifyInContext (C:\Users\User\AppData\Roaming\npm\node_modules\@angular\compiler\bundles\compiler.umd.js:25247:25)

    at StaticReflector.simplify (C:\Users\User\AppData\Roaming\npm\node_modules\@angular\compiler\bundles\compiler.umd.js:25259:15)

    at StaticReflector.annotations (C:\Users\User\AppData\Roaming\npm\node_modules\@angular\compiler\bundles\compiler.umd.js:24598:62)

    at NgModuleResolver.resolve (C:\Users\User\AppData\Roaming\npm\node_modules\@angular\compiler\bundles\compiler.umd.js:17265:84)

    at CompileMetadataResolver.getNgModuleMetadata (C:\Users\User\AppData\Roaming\npm\node_modules\@angular\compiler\bundles\compiler.umd.js:17739:62)

    at CompileMetadataResolver.getNgModuleSummary (C:\Users\User\AppData\Roaming\npm\node_modules\@angular\compiler\bundles\compiler.umd.js:17695:54)

    at C:\Users\User\AppData\Roaming\npm\node_modules\@angular\compiler\bundles\compiler.umd.js:17785:70

    at Array.forEach (native)

    at CompileMetadataResolver.getNgModuleMetadata (C:\Users\User\AppData\Roaming\npm\node_modules\@angular\compiler\bundles\compiler.umd.js:17780:51)

    at addNgModule (C:\Users\User\AppData\Roaming\npm\node_modules\@angular\compiler\bundles\compiler.umd.js:24349:60)

Extraction failed

That’s a bummer Sad smile.

Luckily I found a solution that worked:

  • First I made a copy of the tsconfig.json file
  • Inside this copy I added an ‘exclude’ section to exclude the test.ts:
  • Next I invoked the ng-xi18n tool specifying the altered tsconfig.json as a parameter:

ng-xi18n –p “tsconfig.i18n.json”

Tuesday, March 14, 2017

Cost saving tip when using Azure VM’s

Azure VM’s when you keep them running can cost you a lot of money. So stopping your VM when it’s not in use is certainly a good idea. However you should be aware that there are 2 kinds of ‘stopped’ which are unfortunately not equal.

The first method to shutdown an Azure VM, when connecting for example through Remote Desktop, is to Shutdown the Operating System. In this scenario you go to the Power options within Windows and select Shutdown. This will stop the VM from running but will NOT deallocate hardware. So you will still be paying for the VM hardware allocation.

Note: On the Azure Portal, you’ll see that the VM status will be ‘Stopped’

The second method, and the better one, is to go into the Azure Portal and Stop the VM. This will not only shutdown the VM but also deallocated reserved resources. No further costs will be charged(with the exception of storage for your VM disks).

Note: On the Azure Portal, you’ll see that the VM status will be ‘Stopped(Deallocated)’


If you want you can automate this using Azure Automation and a runbook:

Monday, March 13, 2017

Error when trying to run a Docker Windows container

I’m using Docker Linux container for some time but yesterday I had some extra time and decided to give the Docker Windows container a try.

I opened a command prompt and typed

docker run -it --rm microsoft/nanoserver powershell

Unfortunately I didn’t end with a working container. Instead I got the following output:

Unable to find image 'microsoft/nanoserver:latest' locally

latest: Pulling from microsoft/nanoserver

bce2fbc256ea: Downloading

3ac17e2e6106: Downloading

C:\Program Files\Docker\Docker\Resources\bin\docker.exe: unknown blob.

Turns out that you need to have Windows 10 Anniversary Edition (Professional or Enterprise) running on your physical computer. Sad smile

Time for a Windows Update…

Friday, March 10, 2017

.NET Core NuGet packages

I had an issue with some NuGet package where the localized resource DLL’s were not copied(more about this in another post). My first thought was that the resource DLL’s were not part of the NuGet package.

But as the NuGet package is a .NET Core package, the content is no longer downloaded to a Packages folder relative to your solution. Instead a global folder is used for all the packages on your system.

But what’s the location of this folder?

After a search on my file system I found all packages in the following location:


Angular CLI–Avoid CORS issues

By default when using ng-serve, webpack will serve your Angular 2 content from http://localhost:4200. However when your backend is hosted on a different URI(which probably is the case) you get CORS errors when you try to call your backend:


One solution is to configure CORS on your backend, but if you want to host your frontend code and the backend on the same URI in the end, I have an alternative for you…

Angular-CLI allows you to specify a proxy file. In this proxy file you can specify a URI pattern and webpack will proxy these requests to your backend.

Let’s see some code:

  • My Angular Component. To simplify the codebase I have put everything inside my component. A better way would be to embed the HTTP logic inside a service.
  • A proxy.config.json file. In this file I specify a URI pattern and the target URI.

To invoke the application we have to specify the proxy.config.json path when calling ng serve:

ng serve –proxy-config proxy.config.json

That’s it!

Thursday, March 9, 2017

Azure: Visualize your ARM templates

I’m currently working on setting up an Azure infrastructure using the ARM templates. Although Visual Studio has built-in support for ARM templates, it’s not always easy to configure them correctly and I had to spend a lot of time browsing through the Azure Quickstart templates at

One great tool that helped me a lot was ARMViz. This tool allows you to visualize the resources in your ARM template and their dependencies:


If you click on a specific resource in the diagram you jump straight to the location in the template.json file. Nice!

Wednesday, March 8, 2017

TFS–Build fails after upgrading to TFS 2017

After upgrading to TFS 2017, some of our builds started to fail with the following error message:

System.Management.Automation.RuntimeException: Source path 'd:\b\3\_work\3\s\<Project>\bin\Release\*.*' does not exist.

The issue was caused by our Copy  Files Task as part of our build definition.


Turns out that the Source path can no longer contain wildcards(like *.*) but should point to a specific folder or file. After removing the wildcards everything worked as expected…

From the documentation:


Tuesday, March 7, 2017

Visual Studio 2017 Launch

Today is a big day for Visual Studio. The 2017 version will be released and this will not happen without some buzz.


From the launch site(

On March 7, watch our live stream with Julia Liuson, Brian Harry, Miguel de Icaza, and Scott Hanselman as they share the newest innovations in Visual Studio, .NET, Xamarin, Azure, and more. After the keynote, Microsoft engineers will lead interactive technical demo sessions to help you get the most out of Visual Studio 2017 and the rest of our tools and platform.

On March 8, we’ll help you get productive even faster by hosting a full day of live interactive trainings. Make sure to Save the Date for both days and sign up for the March 8 training now.

Monday, March 6, 2017

SQLException when enumerating through the ClaimsPrincipal.Claims

On a ASP.NET Web Application project we got a strange issue, when enumerating through the Claims collection of the ClaimsPrincipal we got a SQLException Confused smile!?

Strange thing is that there was no place in our code where we were using SQL Server. So where was this error message coming from?

Turned out that the ClaimsPrincipal in ASP.NET is linked to a RoleManager by default that uses SQL Server as the backing store behind the scenes. Once we tried to access the claims, the RoleManager was called who tried to access SQL Server.

To solve it, we removed the default RoleManager module from the ASP.NET configuration using following code:

     <remove name="RoleManager" />

Wednesday, March 1, 2017

The fallacy of code re-use

In software development too much focus remains on re-use. The following quote made me think about a blog post by Udi Dahan I readed years ago