Angular Node

Force Angular Development Server to use external IP

If you want the Angular Development Server ng to serve at the external IP of your computer to allow external clients to access the app, use following command.

ng serve --host= --disable-host-check

Waiting in PowerShell for an action to complete

If you want PowerShell to wait for an action to complete, you can display a loading spinner using these few lines of code.

The script will print a new dot every three seconds until the condition in the until-clause is fulfilled.

The result looks like this:


Pipe output to clipboard

You can use the command line program clip to pipe the output of a command to your clipboard.

Write-Output "Hello World!" | clip
SQL Server Visual Studio

Share a LocalDB instance with other users on the computer

MS LocalDB has the possibility to share your personal LocalDB instance with other users on the computer.

You can use the CLI tool SqlLocalDb.exe to share the instance. It is available in the Developer Command Prompt of Visual Studio.

This is the documentation of the share action:

share|h ["owner SID or account"] "private name" "shared name"
    Shares the specified private instance using the specified shared name.
    If the user SID or account name is omitted, it defaults to current user.


C:\Windows\System32>sqllocaldb share contosolab\doering MSSQLLocalDB ShareLocalDb
Private LocalDB instance "MSSQLLocalDB" (owner: CONTOSOLAB\doering) shared with the shared name: "ShareLocalDb".

Important: the argument “owner SID or account” must be your own user not the user you want to share the instance with.

The instance then appears as .\ShareLocalDb in the list.

C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional>sqllocaldb info

You can use the shared instance in connection strings like this:

Data Source=(LocalDb)\.\ShareLocalDb;database=MyDatabase;trusted_connection=yes;



Grep on Windows – Searching in all files recursively

There’s no command line tool on Windows like Grep on Linux to search for a specific text in all files recursively. But there’s a simple alternative.


grep -r "peter" *


ls * -r | sls "peter"

Lazy Loading with the Lazy class

Did you know the Lazy class in the System namespace?

This little useful helper was introduced with .NET 4. You can use it to lazy initialize properties.

The ResolvePackagePath()-method gets called if the value is needed the first time.
The property IsValueCreated lets you check if the value is already initialized.

ALM Team Foundation Server VSO

TFS/VSTS agent behind a corporate proxy

Many companies use a http proxy with authentication. Since TFS 2017 the agents are based on .NET Core to be cross-platform. The new agents are unable to obtain the proxy settings from the operating system (Internet Explorer settings).

I’ve found this solution to set a http proxy for the VSTS agents.

  1. Create a file .proxy in the agents root folder and write the proxy in it.


  2. Username and password can be set with environment variables
    [Environment]::SetEnvironmentVariable("VSTS_HTTP_PROXY_USERNAME", "proxyuser", "User")
    [Environment]::SetEnvironmentVariable("VSTS_HTTP_PROXY_PASSWORD", "proxypassword", "User")

    See also the documentation on GitHub.


Sending all e-mails in development environment to a local folder

In the app.config/web.config you can use the configuration section <> <mailSettings> <smtp> to configure how to deliver e-mails which are sent using the MailMessage and SmtpClient classes in your program.

In development environment you usually don’t want the e-mails to be delivered. Today I’ve found a awesome configuration option, which enables that all outgoing e-mails go to an local folder or file share as eml files.

app.config / web.config
Sending an e-mail with .NET
Local pickup folder


How to get a temporary file on the fly

Did you already know the methods Path.GetTempPath() and Path.GetTempFileName() in the System.IO namespace.

The very useful method GetTempFileName() creates a temporary file for you in a location you have write access. You then can write temporary data to this file.

.NET C# SharePoint

How to get the Correlation ID of the current request in SharePoint

SharePoint generates for each request a random GUID which correlates all log messages in the ULS log which are printed during the current request. The Correlation ID is also printed to error pages. If you want more information about an error page you can use the Correlation ID to find the right log messages in the ULS log.

Recently I wanted to get the current request’s Correlation ID to share it with an external webservice to have the same correlation ID in all depending systems.

You can add following code to your ASP page to get the Correlation ID.