Friday, May 19, 2017

VS Code–Angular Language Service

Yesterday while listening to the Adventures in Angular Podcast, I heard someone mention the Angular Language Service extension for VS Code.

From the documentation:

This extension provides a rich editing experience for Angular templates, both inline
and external templates including:

  • Completions lists
  • AOT Diagnostic messages
  • Quick info
  • Go to definition

demo

Thursday, May 18, 2017

Improve performance of your ASP.NET Core application

ASP.NET Core is running on Kestrel, ASP.NET Core’s internal web server. Although really fast Kestrel is not a full blown web server. The idea is that you put another web server(on Windows typically IIS) in front of it that acts as a proxy and forwards the requests to Kestrel.

To get this working in IIS, an AspNetCoreModule exists that achieves this goal. Here is the web.config that configures all of this:

If you look at the configuration, you see that by default all request(path="*" verb="*") are forwarded to Kestrel. This isn't ideal because Kestrel is a lot slower in handling static files than IIS.

A better solution is to only forward the requests that should be handled by ASP.NET Core(by example; path="api/*" verb="*") and let other requests be served by IIS.

The magic trick is to use IIS URL Rewrite rules to forward requests to the wwwroot folder of your ASP.NET Core app:

UPDATE: Rick Strahl did a more complete blog post where he took this approach a few steps further: https://weblog.west-wind.com/posts/2017/Apr/27/IIS-and-ASPNET-Core-Rewrite-Rules-for-AspNetCoreModule

Wednesday, May 17, 2017

Visual Studio Live! Videos

Over the years Visual Studio Live! delivered a lot of great content around the globe. On the Visual Studio Magazine blog, you find an overview of all keynotes. Certainly worth checking out…

One of my favorite sessions - Zero to DevOps with VSTS:

Tuesday, May 16, 2017

Visual Studio 2017–Convert to interpolated string refactoring

C# 6 introduces the concept of string interpolation allowing to use expressions inside your string literals providing a type safe alternative to string.format.

Last week I noticed a related refactoring option in VS 2017; when you have an existing string.format statement Visual Studio allows you to convert it to an interpolated string.

Nice!

clip_image002

Monday, May 15, 2017

No assembly found containing an OwinStartupAttribute

After switching to Visual Studio 2017, one of the projects we were working on started to fail with the following error message:

The following errors occurred while attempting to load the app.

- No assembly found containing an OwinStartupAttribute.

- No assembly found containing a Startup or [AssemblyName].Startup class.

To disable OWIN startup discovery, add the appSetting owin:AutomaticAppStartup with a value of "false" in your web.config.

To specify the OWIN startup Assembly, Class, or Method, add the appSetting owin:AppStartup with the fully qualified startup class or configuration method name in your web.config.

In our case we don’t need the OWIN startup detection, so we followed the suggestion as mentioned in the error message and updated our config to:

<appSettings>

       <add key="owin:AutomaticAppStartup" value="false" />

</appSettings>

Strange that we didn’t had this problem before VS 2017…

More information:

Friday, May 12, 2017

Take a look into what’s coming next on Azure–The Azure Preview portal

After the “classic” Azure Portal and the “current” Azure Portal, it’s time to introduce a 3th portal, the PREVIEW portal. The Preview Portal allows you to access Azure Portal features before they are released to the main Azure Portal. This enables a sort of “Insider Preview” for just the Azure Portal.

You can access the Azure “Preview” Portal by visiting http://preview.portal.azure.com

image

Thursday, May 11, 2017

ASP.NET core–Log errors to disk

Quick tip if your ASP.NET core application is crashing and you cannot figure out why.

Inside the web.config of the IIS hosting process, change the configuration. Set the sdtoutLogEnabled property to true and specify a location where to output the logs using the stdoutLogFile property.

<aspNetCore processPath="%LAUNCHER_PATH%" arguments="%LAUNCHER_ARGS%" stdoutLogEnabled="true" stdoutLogFile=".\logs\stdout" forwardWindowsAuthToken="false"/>

Remark: I noticed that I had to create the logs folder first otherwise no files were written to this location…

Wednesday, May 10, 2017

Angular CLI–Documentation and Guidance

I’m a big fan of the Angular CLI, it made my life as an Angular developer a lot easier. It still has some rough edges but Angular was made to use with this kind of tooling.

One of the pieces that is still missing is good documentation. There is some guidance in the Angular documentation and some info on the GitHub website but I found the information to be incomplete(at the moment of writing) and had to fallback to StackOverflow for finding a lot of information.

Last week a colleague heard my complaints about the documentation and sent me a link to The Ultimate Angular CLI Reference Guide. Great tip!

Tuesday, May 9, 2017

.NET Application Architecture

If you want to get some insights on how to architect applications for the .NET stack , Microsoft created https://www.microsoft.com/net/architecture.

Practical advice, best practices, and sample applications for using .NET with microservices, Docker containers, Kubernetes, Xamarin, ASP.NET, Azure, Service Fabric, and more.

image

Monday, May 8, 2017

TFS 2017–How to unconfigure an existing build agent

I couldn’t find good documentation, so here are the steps I used:

  • Browse to the folder where your agent is installed

D:\Builds\Agents\Main1>

  • Execute the /unconfigure command:

D:\Builds\Agents\Main1>agent\vsoagent /unconfigure

Removing EventLog source vsoagent.tfs.Agent-TMD4.

Service vsoagent.tfs.Agent-TMD4 is being removed from the system...

Service vsoagent.tfs.Agent-TMD4 was successfully removed from the system.

Attempt to stop service vsoagent.tfs.Agent-TMD4.

Remark:

First time I tried this, I invoked the command directly from the agent subfolder:

D:\Builds\Agents\Main1\agent>vsoagent /unconfigure

However this failed with the following error message:

You cannot run the vsoAgent.exe interactively from within the Agent folder.

Friday, May 5, 2017

How can I view the used SSL certificate in Chrome?

As of Chrome 56, I noticed that it became a lot harder to inspect the SSL certificate used by a site. You can still access the SSL certificate settings in Windows by opening the Developer Tools (CTRL+SHIFT+i), go to "Security" tab and click the "View Certificate" button.

clip_image002

Thursday, May 4, 2017

TFS Build Agent doesn’t pick up all capabilities

Once a TFS build agent is configured on a build server it should scan the server for all capabilities and add them to a list. These capabilities can then be linked to demands to select an appropriate agent for your specific build script.

image

However at one client we noticed that the list of capabilities for all agents turned out rather empty whereas a lot of components were in fact installed on the server.

Inside the agent logs we found the following error message:

[2017-05-03 09:06:01Z INFO ProcessInvoker] Process started with process id 2828, waiting for process exit.

[2017-05-03 09:06:03Z INFO PowerShellCapabilitiesProvider] STDERR: . : File D:\Builds\dev-agent-3\bin\powershell\Add-Capabilities.ps1 cannot be loaded. The file D:\Builds\dev-agent-3\bin

[2017-05-03 09:06:03Z INFO PowerShellCapabilitiesProvider] STDERR: \powershell\Add-Capabilities.ps1 is not digitally signed. You cannot run this script on the current system. For more in

[2017-05-03 09:06:03Z INFO PowerShellCapabilitiesProvider] STDERR: formation about running scripts and setting execution policy, see about_Execution_Policies at http://go.microsoft.com/f

[2017-05-03 09:06:03Z INFO PowerShellCapabilitiesProvider] STDERR: wlink/?LinkID=135170.

[2017-05-03 09:06:03Z INFO PowerShellCapabilitiesProvider] STDERR: At line:1 char:3

[2017-05-03 09:06:03Z INFO PowerShellCapabilitiesProvider] STDERR: + . 'D:\Builds\dev-agent-3\bin\powershell\Add-Capabilities.ps1'

[2017-05-03 09:06:03Z INFO PowerShellCapabilitiesProvider] STDERR: +   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

[2017-05-03 09:06:03Z INFO PowerShellCapabilitiesProvider] STDERR:     + CategoryInfo          : SecurityError: (:) [], PSSecurityException

[2017-05-03 09:06:03Z INFO PowerShellCapabilitiesProvider] STDERR:     + FullyQualifiedErrorId : UnauthorizedAccess

[2017-05-03 09:06:03Z INFO ProcessInvoker] Finished process with exit code 1, and elapsed time 00:00:01.2248303.

On this server a group policy is applied that prevents the execution of unsiged Powershell scripts. As the agent is using Powershell to scan a system for capabilities it failed silenty behind the scenes.

The solution was to ask the server team to sign all scripts for us.

Wednesday, May 3, 2017

Explaining LINQ visually

If you are not convinced in using LINQ yet, go have a look at Michael Sorens blog post. He nicely visualize the behavior of (almost) every LINQ operator and provides a set of characteristics of each LINQ operator explaining position, syntax,execution, laziness, complexity and any optional features.

A must read for every .NET developer!

image

image

Tuesday, May 2, 2017

MSTest–Setting the Culture of your tests

Last week after introducing localization into our application our builds started to fail. Inside the build log we saw that only tests related to localization were failing.

What happened? The problem was that the tests where expecting a specific culture to be set which was different on our local machines compared to the build server. So we needed a way to set the (UI)culture for our tests.

A solution that worked for us was to set the CultureInfo.DefaultThreadCurrentCulture and CultureInfo.DefaultThreadCurrentUICulture in the Assembly initializer of our tests:

 

Remark: Don’t forget to add the [TestClass] attribute on top of your class otherwise MSTest will not invoke the AssemblyInitialize method.

Monday, May 1, 2017

TFS 2017–How to uninstall the ElasticSearch service?

One of the new features of TFS 2017 is the introduction of a code search service. This service is built on top of a customized version of ElasticSearch and can be installed together with the rest of the product.

However the experience is still somewhat rough around the edges.

For example deleting the ElasticSearch service can’t be done through Add/Remove Programs or through an UI but you have to fallback to Powershell instead:

  • Open Powershell as an administrator
  • Go to the folder where ConfigureTFSSearch.ps1 is installed.
  • Run the script again with the remove option: "ConfigureTFSSearch.ps1 -RemoveTFSSearch"

In case you cannot find this Powershell commandlet an alternative option is to browse to the ElasticSearch bin directory and execute the following command:

  • service.bat remove

Friday, April 28, 2017

TF246017: Team Foundation Server could not connect to the database

A colleague forwarded me the following error message:

clip_image002

The problem occured when he tried to create a branch, but only on this specific project we had issues.

Time to log on the TFS server and check the Event Log. There I found the following error message:

DESCRIPTION: SQL Server Assertion: File: , line=951 Failed Assertion = 'IS_OFF (BUF_MINLOGGED, m_buf->bstat) || pageModifyType != PageModifyType_Contents || GetPagePtr ()->IsTextPage ()'. This error may be timing-related. If the error persists after rerunning the statement, use DBCC CHECKDB to check the database for structural integrity, or restart the server to ensure in-memory data structures are not corrupted.

This error message brought me to the following Connect ticket: https://connect.microsoft.com/SQLServer/feedback/details/3005568/sql-server-2016-merge-statement-fails-when-running-db-in-simple-recovery-model

I first tried to install all possible updates but no luck, the issue remained. Then I saw that in the ticket they mention switching to the Full recovery model. I tried that and it seemed to work.

Now

Thursday, April 27, 2017

Angular – Component Libraries

The new Angular(can’t call it Angular 2 anymore) ecosystem is still evolving. Control libraries start to appear.

Here are some of the libraries I had a look at:

(Don’t ask me which one I prefer, as with all control libraries they have their pros and cons you’ll have to learn to live with…)

Angular Material

Material Design components for Angular apps https://material.angular.io/

Remark: The Angular Material library for Angular >=2 is still rather limited. Don’t confuse it with the Angular 1 variant at https://material.angularjs.org/latest/.

image.

NG-Lightning

Native Angular components & directives for Lightning Design System http://ng-lightning.github.io/ng-lightning/#/

Created by the Salesforce’s guys on top of Angular and Salesforce's Lightning Design System.

image

TERADATA Covalent

Covalent(https://teradata.github.io/covalent/#/) is a UI Platform that combines proven design language with a comprehensive web framework, built on Angular & Angular-Material (Design).

image

PrimeNG

PrimeNG(https://www.primefaces.org/primeng/) is a collection of rich UI components for Angular 2. PrimeNG is a sibling of the popular JavaServer Faces Component Suite, PrimeFaces.

image

Kendo Angular UI

Professional Grade Angular UI Components http://www.telerik.com/kendo-angular-ui/

image

Wednesday, April 26, 2017

IT Manager, it’s a monkey job…

In my current job I’m active as a manager where I have a team of +20 people. My main focus is to guide these people through their career and help them grow into professional IT consultants. Sometimes I get completely overwhelmed by the questions, problems,little and bigger things, … that people keep asking me.

My manager(the manager’s manager Winking smile) noticed it and shared the following article from Harvard Business Review with me; Management time: Who’s got the monkey?. Although from 1974(!) still as relevant today…

image

Don’t forget the follow up article Making time for Gorillas(part of the same link).

Thanks J├Ârgen for the tip! And now I have to go as it is time to get the monkeys of my back…

Tuesday, April 25, 2017

Add extra NuGet Repositories through nuget.config

By default Visual Studio has one NuGet source registered out of the box, the official NuGet gallery at https://www.nuget.org/.

However I had to use a package that wasn’t hosted on the official NuGet gallery but instead could be found on MyGet.org(https://www.myget.org/). Problem was that I didn’t want to ask all developers to register an extra Package Source in Visual Studio.

So what’s the alternative?

The trick is to add a nuget.config file to your solution.

From the documentation:

The behavior of every NuGet command, whether issued from the command line, the Package Manager UI, or the Package Manager Console, is driven by the accumulated settings from any number of NuGet.Config files:+

  • Project-specific NuGet.Config files located in any folder from the solution folder up to the drive root. These allow control over settings as they apply to a project or a group of projects.
  • A solution-specific NuGet.Config file located within a .nuget folder in the solution. Settings in this file apply only to solution-wide packages and is supported only in NuGet 3.3 and earlier. It is ignored for NuGet 3.4 and later.
  • The global config file located in %APPDATA%\NuGet\NuGet.Config, which is always used unless you specify a different config file using the -configFile switch on any NuGet command

Inside this nuget.config you can register extra package sources:

Monday, April 24, 2017

Angular 2 Pipes– args are not arguments :-)

Today I lost some time investing an issue with Angular 2. I was creating an Angular pipe using Angular CLI. The code that was generated for me was the following:

Unfortunately I wrongfully assumed that the args keyword was refering to the arguments object we have in the JavaScript language. Turns out that this was a wrong assumption. Since Angular beta.16 the parameters are not passed as array to the transform() method anymore but instead as individual parameters:

{{ myData | translate:'arg1':'arg2' }}


export class TranslatePipe implements PipeTransform {   
  transform(value:any, arg1:any, arg2:any):any {
        ...
}

I would suggest to the Angular CLI team to change the name of the argument, because the args name causes confusion. Or is it just me?

Friday, April 21, 2017

Use Swagger-UI to test your Open API

In case your REST api exposes an Open API specification document, but you didn’t integrate Swagger UI to allow developers to browse and test your API, they can still use the Swagger-UI capabilities by directly browsing to http://petstore.swagger.io and put the url in the box at the top of the page. Alternatively, they can add the url of the service to the end with ?url= such as http://petstore.swagger.io?url=https://raw.githubusercontent.com/OAI/OpenAPI-Specification/master/examples/v2.0/json/api-with-examples.json.

image

Thursday, April 20, 2017

ASP.NET Core Web Deploy–XML Documentation files are not copied

After deploying our ASP.NET Core application using Web Deploy, we noticed a problem with our Swagger integration through SwashBuckle. Normally SwashBuckle can integrate documentation in your Swagger UI by extracting and reading the XML comments added to your code.

Problem was that when this XML isn’t copied Swashbuckle throws an exception making our whole API unavailable. Some research showed that the problem appeared after migrating from the project.json format back to csproj, after which the <DocumentationFile> was no longer automatically copied to the output folder during the build or publish process.

The solution I used was to add the following snippet to your csproj:

Wednesday, April 19, 2017

TFS Release error - WinRM cannot complete the operation.

After creating a release pipelin in Team Foundation Server, I got the following error during deployment: 
Connecting to remote server failed with the following error message : WinRM cannot complete the operation. Verify that the specified computer name is valid, that the computer is accessible over the network, and that a firewall exception for the WinRM service is enabled and allows access from this computer. By default, the WinRM firewall exception for public profiles limits access to remote computers within the same local subnet. For more information, see the about_Remote_Troubleshooting Help topic.
As the error mentions first thing to check if I can use WinRM to invoke Powershell remotely. Therefore login on the target server and execute the following command:
  • winrm quickconfig

image

  • I said yes to apply the suggested changes

image

And indeed, no exception was configured on the firewall to allow access from remote computers. The winrm quickconfig did all the work for me to fix the situation. Nice!

Tuesday, April 18, 2017

ASP.NET Core 1.1 –Error in Response Caching Middleware

After putting a first version of our ASP.NET Core application into acceptance, we got a strange bug back.

Sometimes after a cold start, users mentioned that the dropdown lists inside the application were empty. The application is using the Response Caching middleware to prevent having to fetch those lists over and over again from the database.

When looking at the server logs, we found the following error message:

exception": "System.ArgumentException: An item with the same key has already been added. Key: \r\n at System.ThrowHelper.ThrowAddingDuplicateWithKeyArgumentException(Object key)\r\n at System.Collections.Generic.Dictionary2.Insert(TKey key, TValue value, Boolean add)\r\n at System.Collections.Generic.Dictionary2.Add(TKey key, TValue value)\r\n at Microsoft.AspNetCore.Server.Kestrel.Internal.Http.FrameResponseHeaders.AddValueFast(String key, StringValues value)\r\n at Microsoft.AspNetCore.Server.Kestrel.Internal.Http.FrameHeaders.System.Collections.Generic.IDictionary<System.String,Microsoft.Extensions.Primitives.StringValues>.Add(String key, StringValues value)\r\n at Microsoft.AspNetCore.Server.Kestrel.Internal.Http.FrameHeaders.System.Collections.Generic.ICollection<System.Collections.Generic.KeyValuePair<System.String,Microsoft.Extensions.Primitives.StringValues>>.Add(KeyValuePair2 item)\r\n at Microsoft.AspNetCore.ResponseCaching.ResponseCachingMiddleware.d__10.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at System.Runtime.CompilerServices.TaskAwaiter1.GetResult()\r\n at Microsoft.AspNetCore.ResponseCaching.ResponseCachingMiddleware.d__11.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---

Seems there is a bug in the Response Caching Middleware, the response caching middleware is causing an exception when it tries to add the same header. This is a bug that should be fixed in  the ASP.NET Core 1.1.1 patch.

Monday, April 17, 2017

Canvanizer

Last year our CEO gave a session about ‘Business Model You’, or how to create your personal business model canvas. I really liked the session and how it made you think about your strenghts, weaknesses and the value you create for your company and customers.

I’m still using this approach today. Last week I found Canvanizer, a free tool that simplifies the creation of a Business Model canvas.

image

Friday, April 14, 2017

Using the Visual Studio 2017 Offline Installer

Visual Studio 2017 offers a new installation experience with better modularity, a smaller footprint and quicker results.

As a consequence, you no longer have a big ISO file containing all possible components, instead you get a small exe and all other files are downloaded on the fly.

Visual Studio 2017 setup dialog

Works great unless you need to install Visual Studio when you don’t have Internet access. An offline installer can be created by following the steps as described here: https://docs.microsoft.com/en-us/visualstudio/install/create-an-offline-installation-of-visual-studio

Afterwards you can copy the generated offline installer(some executables and a large list of packages) to the location where you want to use it. What is really important is that you first install the provided certificates(they are in the Layout\Certificates folder). The certificates don’t have a password, so just keep clicking next until the installation completes. If you don’t install the certificates first, we noticed that the installer still tries to go online to download the packages.

Afterwords you can run the installation exe.

Thursday, April 13, 2017

Angular CLI–Include a static html file

While integrating OIDC into my Angular app, I had to add a separate authentication page(originally named auth.html). However after bundling and serving my application using ‘ng serve’ I noticed that I couldn’t reach my ‘auth.html’ file and I got an error message instead…

The solution was obvious, any extra files you want to include should be added to the assets section inside the angular-cli.json file:

Wednesday, April 12, 2017

Azure API Management–Mock your service

A nice addition to Azure API Management is the mock-response policy. It allows developers to call your API without invoking the real backend service.

Here are the steps involved to configure mocking from the Azure Portal:

  • Browse to the Azure Portal
  • Open an API Management instance.
  • Click on APIs.

image

  • Click on an API

image

  • Then, for the scope of either All operations or any particular operation, open the Inbound processing editor.

image

  • A new tab titled Mocking is now available.

image

  • Change the Mocking behavior to Static responses and choose a Response from the list

image

Tuesday, April 11, 2017

Visual Studio 2017–.editorconfig

Visual Studio 2017 adds support for .editorconfig files within projects to help developers define and maintain consistent coding styles between different editors and IDEs, which can be useful for large development teams looking to maintain a consistent style across their code base.

Teams can configure convention preferences and choose how they are enforced inside the editor (as suggestions, warnings, or errors). The rules apply to whatever files are in the directory that contains the EditorConfig file. If you have different conventions for different projects, you can define each project’s rules in different EditorConfig files if the projects are in separate directories.

More about the EditorConfig project: http://editorconfig.org/

Easiest way to get started is by installing Mads Kristensen's EditorConfig extension, which can be downloaded from the Visual Studio Marketplace and will provide full autocompletion, syntax highlighting, and much more.

Remark: You don’t need this extension but it makes editing the .editorconfig files so much easier

After installing the extension it is time to open Visual Studio and load a solution.

  • Right click on a project. Choose Add –> .editorconfig File

image

  • Thanks to the extension you’ll get autocompletion

image

If you do not wish to use an EditorConfig file or you want to configure rules that your team hasn’t explicitly set, go to Tools>Options>Text Edtior> [C#/Basic]>Code Style to configure your machine local settings.

image

More information: https://docs.microsoft.com/en-us/visualstudio/ide/create-portable-custom-editor-options

Monday, April 10, 2017

#MakeWhatsNext–A cry out for more diversity in IT

I find it really unfortunate how little diversity there remains in the IT world. An era ago there were more women in IT than today! Something has to change…

We all play a role to change this and education will be one of the key pillars. Time to support #makewhatsnext

Friday, April 7, 2017

Avoiding seagull architects

During one of my trips to work I was listening to a DotNetRocks episode with Mark Seemann(this one to be precise: http://dotnetrocks.com/?show=1418).

In this episode Mark mentioned a ‘seagull architect’:

A seagull architect swoops in, poops out a lot of powerpoints, then flies off to let others implement it, evolve it, and solve the real problems.

This term comes from a book called Behind Closed Doors – Secrets of Great Management, a book that I immediatelly added to my reading list. Smile

Cover image for Behind Closed Doors

Thursday, April 6, 2017

TFS 2017 - VS402642: Found a backup job running against Tfs_DefaultCollection database

Last week during a TFS upgrade we noticed that the upgrade for one of the collections failed with the following error message:

VS402642: Found a backup job running against Tfs_DefaultCollection database. Wait for the backup job to complete and then rerun the failed collection job from the Status tab

Before starting the upgrade the sys admins already configured the backup jobs which intervened with the upgrade that was going on.

We were first afraid that we had to restart the whole upgrade procedure but it turns out that the TFS upgrade procedure is a lot more robust. As we were able to upgrade all the other collections and the configuration database, we had a working Team Foundation server system available. Only this one collection was missing.

To fix it, we first disabled all configured jobs inside the SQL Server instance.

Next step is to rerun the upgrade procedure for this collection:

  • Log in on the Team Foundation Server application tier
  • Open the Team Foundation Administration Console
  • Click on the Team Project Collections tree item on the left

image

  • Click on the collection that has failed to upgrade from the list on the right. The State would normally show as ‘Offline’

image

  • Go to the Status tab

image

  • Select the upgrade job from the list(normally the one on top of the list) and click Rerun job.

image

Wednesday, April 5, 2017

Team Explorer is back

Visual Studio 2013 and before had a seperate installer for Team Explorer. This allowed non-developers to access Team Foundation Server and all it’s functionality without the need to install a Visual Studio version. In VS 2015, Microsoft did not release a standalone Team Explorer but pointed customers to the free Express SKUs and Community editions, which included Team Explorer functionality.

This week with the Visual Studio 2017 Update release, the standalone Team Explorer installer is back. This is a free download for non-developers who connect to Team Foundation Server or Visual Studio Team Services.

Remark: Note that you probably still need a CAL(client access license).

Tuesday, April 4, 2017

Manual install of the Java JRE

Today I had to install the Java JRE on a server to be able to use ElasticSearch. Unfortunately I couldn’t install any software that allowed me to extract and run the tar.gz file on the server.

Here is my workaround:

Download and extract

  • Start by downloading the Java 8 Server JRE.
  • Once downloaded, unzip the tar.gz file. You’ll get a tar file.
  • That tar file should be unzipped again. The output of this second unzip operation was a set of binaries and executables.
  • Copy these files over to a file share on the target server.

Installation

  • Create a folder C:\Program Files\Oracle Java Server on your server.
  • Browse to the content of the file share.  Go one level deeper e.g. jdk1.8.0_XX (where XX is the current update version) and copy this content to the new folder on your server.

Set JAVA_HOME environment variable

Finally we need to set an environment variable to point to our new Java installation:

  • Open the System Properties.
  • Click the Advanced tab and the Environment Variables button.
  • Click New... at the System Variables.
  • Use JAVA_HOME as the name of the variable and the path C:\Program Files\Oracle Java Server as the value.
  • Finish this job by clicking OK until your are back at the control panel.

That’s it!

Monday, April 3, 2017

Reporting Services 2014 upgrade error

After upgrading to SQL Server 2014, we encountered the following issue while configuring the Reporting Services:

When we tried to restore the Reporting Services Encryption key, it always failed. Inside the error logs we found the following information:

The version of the report server database is either in a format that is not valid, or it cannot be read. The found version is ‘163’. The expected version is ‘162’. (rsInvalidReportServerDatabase).

A quick search on the web brought us to the following post: https://blogs.msdn.microsoft.com/sql_server_team/upgrading-to-sql-2014-report-server-version-mismatch/

The problem can happen when you upgrade from a SQL 2012 SP2 server with CU5 or later, the database will have a higher version number than what SQL 2014 expects.

Luckily there was already a solution out there. I asked the server team to upgrade to SQL 2014 CU7 after which the issue was gone…

Friday, March 31, 2017

Azure–Assign a reserved (public) IP address to an existing Cloud Service

A customer asked me to assign a static IP address to an existing Cloud Service in Azure. It took me same time to figure out the exact procedure to do this. So here are the steps involved:

  • Open the Powershell console and install the Azure Powershell commandlets(if you didn’t had done this already)
    • Install-Module AzureRM
  • Now let’s first login to Azure
    • Add-AzureAccount
  • You can check if you are logged in succesfully
    • Get-AzureAccount
  • Let’s activate a specific subscription
    • Select-AzureSubscription
    • Specify the SubscriptionName
  • Now you can convert the assigned dynamic IP for your cloud service to a static reserved IP address
    • New-AzureReservedIP –ReservedIPName MyStaticIP –Location "West Europe" -ServiceName MyServiceName

Remark: Executing the last command can take a while, so don’t panic if nothing seems to happen…

Thursday, March 30, 2017

Docker error - Error response from daemon: manifest for :latest not found

When trying to download a docker image for Eureka using docker pull, I got the following error message:

docker pull netflixoss/eureka

Using default tag: latest

Error response from daemon: manifest for netflixoss/eureka:latest not found

It seems that by default a :latest tag is added to the command. When I checked the Docker Hub I noticed that the ‘latest’ tag didn’t exist:

image

I changed the command to explicitly include the tag:

docker pull netflixoss/eureka:1.3.1

That solved the problem…

Wednesday, March 29, 2017

Visual Studio 2017 Best Feature Ever!

Yesterday I discovered a great addition to Visual Studio 2017. When a NullReferenceException is thrown you not only get the familiar‘Object reference not set to an instance of an object’ error message, but you also get some information about which object exactly is null. Finally!

image

Note: Null reference analysis in managed code requires .NET version 4.6.2. Null analysis is currently not supported for Universal Windows Platform (UWP) and any other .NET Core applications. It is only available while debugging code that does not have any Just-In-Time (JIT) code optimizations.

Tuesday, March 28, 2017

Visual Studio 2017–.NET 4.6.2 is missing

After installing Visual Studio 2017, I noticed that .NET 4.6.2 was still missing from the version list. Strange! Especially because the .NET site mentions otherwise:

image

Luckily you can add it by installing the .NET Framework 4.6.2 Developer Pack from here

Once installed you will see .NET 4.6.2 added to the list of supported versions:

image

Monday, March 27, 2017

NPM–Exclude files from your package

By default NPM will include all files as part of your package. But how can you exclude certain files?

To support that scenario NPM has the concept of a .npmignore file similar to a .gitignore file(Note: in case there is no .npmignore file, but there is a .gitignore file, nom will ignore the files matched by the .gitignore file).

.npmignore files follow the same pattern rules as .gitignore files.

Additionally, everything in node_modules is ignored, except for bundled dependencies. npm automatically handles this for you, so don't bother adding node_modules to .npmignore.

The following paths and files are never ignored, so adding them to .npmignore is pointless:

  • package.json
  • README (and its variants)
  • CHANGELOG (and its variants)
  • LICENSE / LICENCE

Friday, March 24, 2017

Angular 4 is out!

Angular 4 is out! My first reaction was WHAT? Did I miss the release of Angular 3 somewhere? Turns out that they decided to skip a version to align with the Angular version 4 router(an announcement that I missed somehow).

The focus on this release is making Angular applications smaller and faster. I’ll start upgrading my projects this weekend.

Expect a follow-up post with my experiences soon…

PS: Here is the announcement on their blog: http://angularjs.blogspot.be/2017/03/angular-400-now-available.html

Thursday, March 23, 2017

TypeScript - TS2403 Subsequent variable declarations must have the same type. Variable 'module' must be of type 'NodeModule'

Got a TypeScript error when trying to get my Angular app up and running:

Error      TS2403  Subsequent variable declarations must have the same type.  Variable 'module' must be of type 'NodeModule', but here has type '{ id: string; }'.   TypeScript Virtual Projects               C:\projects\MyAngularClient\src\typings.d.ts               2             Active

To fix it, I had to comment out the module declaration typings.d.ts:

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!     <
https://github.com/npm/npm/issues>

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 http://browsenpm.org/package.json

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(https://registry.npmjs.org) 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

image

After logging in, go to Scheduled Tasks below System settings

image

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.

image

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.

visualstudio2017_productlaunchposter-1

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: https://github.com/angular/angular-cli#updating-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)’

VMPowerState

If you want you can automate this using Azure Automation and a runbook: https://docs.microsoft.com/en-us/azure/automation/automation-solution-vm-management

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…