Like what you see on Windows Spotlight? Save it!

2015-12-03

Have you turned on Windows Spotlight in Windows 10? It's a new Lockscreen background every few days and so far I've been enjoying the pictures tremendously.

If you haven't tried Spotlight before, try turning it on:

In Windows 10 (1511) open the settings panel and navigate to Personalization and then Lock screen. Select Windows spotlight in the dropdown for Background. Scroll all the way down and hit Apply.

Work around now commercial features of OpsHub VSO Migration Utility

2015-11-30

OpsHub has a relatively simple tool to help you migrate your work items and version control data from an on-premise TFS server to Visual Studio Team Services. They recently released version 2.0, which brings a number of improvements.

Unfortunately this new version has also removed some of the features which were previously free and moved them to an intermediate commercial version between the Free and the full fledged OpsHub Integration Manager.

Mount OneDrive as a Network Drive

2015-11-27

Ever wanted to upload a lot of data to OneDrive without having to sync that folder to your local machine (updating my music library is pretty hard, as to put data into the folder, I first need to sync it locally).

Ever wanted to download a few specific files from OneDrive without syncing them first?

Ever wanted to operate on your OneDrive files as if they were real local files?

That is all possible! The trick is to mount your OneDrive as a Network Drive. The trick is pretty simple and is explained here. The only thing I have to add to it is that if you're using 2-Factor Authentication (which you should), then you'll need to generate an app-specific password.


Visual Studio Online is now Visual Studio Team Services

2015-11-18

In an attempt to remove the confusion whether Visual Studio Online is an IDE in the Cloud, Microsoft has decided to rename Visual Studio Online to:

Visual Studio Team Services

Which nicely abbreviates to VSTS, an acronym people who were using TFS in the 2005 and 2008 era may remember :). In remembrance of that great heritage:


Note to self: Here we go again, renaming all tags on the blog and trying to get the StackOverflow tag renamed *again*.

Debug your TFS/VSO 2015 builds

The new build engine of Visual Studio Online and TFS 2015 is great. It's simple, easy to configure and doesn't require complex workflow designers. But when it's not doing exactly what you want it to do, it can be hard to figure out where it's going wrong.

There is a trick to enable verbose logging on the tasks of your build, which will make them generate lot more information. This additional information has saved me more than once since I learned of the existence of this trick.

To enable debug logging simply create an extra build variable called System.Debug and set the value to true.



Enable parallel execution of tests using the Visual Studio Test Runner 2015.1

2015-11-16

Does your machine have multiple CPU's or cores? Are your tests truly independent and thread safe? In that case you'll be able to speed up your test runs considerably by enabling multi-threaded support to the Visual Studio Test Runner.

This works in both Visual Studio as on your build server.

To get the benefits, add the following snippet to your .runsettings file:


<?xml version="1.0" encoding="utf-8"?>
<RunSettings>
  <RunConfiguration>
    <!-- Add this line, default is 1, which makes it run single threaded -->
    <!-- 0 will use all available cores -->
<MaxCpuCount>8</MaxCpuCount>
  </RunConfiguration>
</RunSettings>


This is an all or nothing setting in Visual Studio, but in TFS Build you can specify multiple test runs, each with their own .runsettings. So for your CI build you'll be able to run all your unit tests in parallel, but then execute your integration tests serially, if needed.

This setting is built into the test runner, as such it doesn't require special support from the test adapters for the different frameworks.

C# Interpolated Strings in older .NET frameworks

2015-09-09

When targeting a .NET 4.0 or 4.5 project it's not possible by default to use the Interpolated Strings and their FormattableString and IFormattable counterparts. By default

But, this is only because these two types didn't ship with the older version of the .NET Framework. If you make sure these classes are available to the C#6 compiler, it will happily produce an assembly which is compatible with the older versions of the .NET framework, since these interpolated strings are a language feature and not dependent on the Common Language Runtime.

You'll need these classes to pass a CultureInfo in order to satisfy Code Analysis 1305.

Someone beat me to creating a NuGet Package of the classes required, which makes this as simple as running:

install-package StringInterpolationBridge

C# 6 Interpolated Strings and Code Analysis (CA1305)

C# 6 introduces a new concept, Interpolated Strings, sort of the compiler version of String.Format. It's a great way to ensure that the compiler checks that your variables actually exist and that you're passing the right number of 'm.

And as with String.Format it's important to pass the correct CultureInfo to it to ensure that you're showing the right date formats, "." or "," as decimal separator etc.

By default it will use the CurrentCulture, which makes sense when formatting data to display them in the User Interface. In many other cases, however, you'd want to format your data in Invariant form, when writing to a file, calling an external service or storing data in a database.

To ensure that you, as a developer have thought about this, there is a Static Code Analysis rule that ships with Visual Studio, CA1305: Specify IFormatProvider. Unfortunately the documentation of this rule has not been updated to show how to supply the IFormatProvider or CultureInfo to an Interpolated String.

There are multiple ways to handle this, but all involve casting the Interpolated String to a FormattableString or a IFormattable. The way that's the most straightforward is to cast the formattable string and then call .Tostring on it:

FormattableString fss = $"Hello, {name}";
fss.ToString(CultureInfo.InvariantCulture);

While this works, it'll probably drive every developer crazy, having to create a variable or being creative with casting:

((FormattableString) $"Hello, {name}").ToString(CultureInfo.InvariantCulture);

which won't make your code easier to read one bit, I'd almost stick to String.Format ;).

There is a very interesting trick which combines another C#6 feature, static imports and the calling the Invariant method:

using static System.FormattableString;
...
string x = Invariant($"The value is {m}");

Unfortunately, Microsoft decided to not create a static CurrentUI nor the static Current variant, which I feel is a shame. Or course it would not take much to create your own versions of these static methods:

public static string Current(FormattableString formattable)
{
    if (formattable == null)
    {
        throw new ArgumentNullException("formattable");
    }
    return formattable.ToString(Globalization.CultureInfo.CurrentCulture);
}

public static string CurrentUI(FormattableString formattable)
{
    if (formattable == null)
    {
        throw new ArgumentNullException("formattable");
    }
    return formattable.ToString(Globalization.CultureInfo.CurrentUICulture);
}

See also:

Turn off Visual Basic 14 language features in Visual Studio 2015

2015-07-16

If you're on a team that's doing solution round-tripping between Visual Studio 2013 and 2015, then it's usually a good idea to turn off the latest Language features. That way you don't break the 2013 users, yet are able to use all the other new goodies that 2015 brings.

The C# Project Properties offer a nice UI feature to do this, even though it's well hidden in the property pages.

Visual Basic .NET doesn't have the UI, but it does have the same feature. When you change the property in the UI of the C# project it sets a <langversion> tag in your project file:

<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
    <PlatformTarget>AnyCPU</PlatformTarget>
    <DebugSymbols>true</DebugSymbols>
    <DebugType>full</DebugType>
    <Optimize>false</Optimize>
    <OutputPath>bin\Debug\</OutputPath>
    <DefineConstants>DEBUG;TRACE</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
    <WarningLevel>4</WarningLevel>
    <LangVersion>3</LangVersion>
  </PropertyGroup>

Doing the same thing in your .vbroj actually has the desired result:

<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
    <PlatformTarget>AnyCPU</PlatformTarget>
    <DebugSymbols>true</DebugSymbols>
    <DebugType>full</DebugType>
    <DefineDebug>true</DefineDebug>
    <DefineTrace>true</DefineTrace>
    <OutputPath>bin\Debug\</OutputPath>
    <DocumentationFile>ConsoleApplication1.xml</DocumentationFile>
    <NoWarn>42016,41999,42017,42018,42019,42032,42036,42020,42021,42022</NoWarn>
    <LangVersion>11</LangVersion>
  </PropertyGroup>

This is the result:



NDepend 6 offers native integration into TFS 2013

2015-06-08

When Patrick Smacchia contacted me a couple of weeks back to look at his new TFS support for NDepend I was very excited. We've integrated NDepend through commandline calls  with numerous clients and though that works, it's not very easy to get trend analysis or act upon the findings in the build.



The new integration is native, offering full and fast integration without the need to redo any calculations or compilation on order to get the most out of it. Over the last two weeks I've worked very closely with Patrick to make the integration even smoother, enabling Code Coverage results for the Visual Studio Test Runner and adding a few tweaks here and there.

You can now download the latest Release Candidate and give it a spin. 

With the new version NDepend also integrates into Team City and Sonar, making it a new standard among code quality tooling.

I'm sure I'll be working with Patrick in the future to help enable VSO, Team Build 2015 and Build vNext support. If you have any thoughts on how we could make the integration even better, then please reach out.

Time for a new laptop

2015-05-22

It's time for a new laptop, that means time to figure out what to re-install and what to let go of. I'm always curious to what others run on their machines to boost productivity, and really enjoyed the blog posts from, for example Scott Hanselman and Roy Osherove (back in 2010) on this topic. I through, as I need to create a list of items to download and install anyway, I might as well make it public.

So here we go:

Windows 8.1 Professional 10
Lenovo released the drivers for Windows 10 for the Carbon Touch X1. These also solved a couple of issues I had with the Windows 8.1 drivers, including Youtube videos that would cause 100% cpu and stuttering (due to failing hardware decoding), Photoshop crashes (due to old video driver) and flaky wifi. I've used the default drivers from Windows Update as much as possible, amending it with the drivers from the Lenovo website where none were offered by Microsoft.

Office 365 2016
Office 365 offers both cloud mail, storage and licenses for Office on my machine. It's one click streaming install is an easy choice.

TechSmith SnagIt & Camtasia
As a blogger, StackOverflow user, presentation builder, guidance author, SnagIt the bomb. Quickly grab a piece of your screen, annotate it, do basic editing and either upload it to the cloud or copy/pate it directly into your latest StackOverflow answer.

The on-screen video recording features are very useful as well, as often a short video says more than static pictures.

Camtasia then helps put these all together and makes it look professional.

Rufus
Playing around with Windows 10, creating rescue environments, demo-on a stick, Rufus helps you create boot images on USB sticks using ISO files downloaded from your MSDN subscription. It's easy to use, has never let me down and can create drives that support both old-style BIOS and UEFI.

Free Download Manager
Ever had to download a Brian Keller VM?! Free Download Manager is *the* tool to do it. Though I always turn off Torrent support, not sure what company policy would think of having that running. Plus it prevents me from accidentally downloading stuff I shouldn't be.

NetSetMan Pro
As a consultant I generally visit different clients, all with different networks. Some offer a simple guest network, others require  Proxy setup and each of course has its own printer. NetSetMan Pro allows you to manage your network settings and windows defaults and can automatically switch the settings based on the Wireless networks in range. Quite useful. It's the best out of a bunch I've tried. One very useful feature is its ability to run on the log-on screen. So if you recently changed a password or need to log on using a user that hasn't used your machine before out of the office, it can fire up your VPN or connect to a wireless network to do just that.

Calibre
As an avid Kindle user I have more ebooks than I have space on my Kindle. Especially IT books with lots of screenshots take up a huge part of your limited device space. Calibre catalogs them all, fixes their metadata (so you can find them again), links them to Goodreads and Amazon so your ratings are for more than you alone. It's especially nice for books from Leanpub, HumbleBundle and Kickstarter books.

Unfortunately it still isn't the best reader on your laptop or tablet. So I have the Kindle for Windows app installed side-by-side.

CDBurnerXP
Last time I had to burn a DVD is some time ago... So I've opted for this great free solution. No expensive licenses for features I'll never use. Creating audio CD's and backing up pictures for friends is just about what I use this for.

F.lux
Ever look at the clock during a late night coding session and find out that it's already 3:30am? The blue light from your screen prevents your body from making the right substances to make you tired. This can be a blessing (if you need to finish a presentation before tomorrow morning) or a curse (if you need to give an already finished presentation tomorrow morning).

F.lux detects your place on earth and adjusts your screen brightness and tint according to the position of the sun.

Don't forget to turn it off when editing photo's or video's (or capturing screenshots), but keep it running at all other times. It's helped me get a much better sleep rhythm. There is a similar app called Twilight that does the same thing for your Android phone.

Fre:Ac
Converting audio formats is one of those things you'll need not to do often. Fre:Ac doesn't have the most up to date UI and it isn't as good as some of the commercial available alternatives, but hey, it's free! And it does what it needs to do, produce great quality audio files in every format imaginable.

Tag&Rename
Along the same lines as Fre:Ac and Calibre, Tag&Rename is one of those very useful tools to make sure the metadata on your files matches it's contents. That your Plex server will be able to group and index your music effortlessly and your car's stereo player won't crash on malformed ID3 tags. I've tried free alternatives, but the integration into Amazon for cover downloads and metadata, plus the easy formatting macros to both rename files and extract tags from existing names makes this the best tag editor out there.

7zip
Many years ago, when Winzip was the bomb, it was the only tool you needed, then Rar came along and in short time the different compression formats exploded. Winzip turned from a simple tool into a complicated wizard and WinRAR never releases a free version (though it's trial ran forever). Then 7zip came along. It can decompress all formats I've encountered in the past years, it's fast, it has the ability to encrypt the file names in the archive (to mail files past pesky mailservers) and has one of the best compression ratios int he industry. Did I mention that it's free and simple to use?

Unchecky
When you're installing so many free tools (and probably a java runtime, some browser plugins and Acrobat Reader), you'll be unchecking a lot of checkboxes for browser toolbars, explorer extensions and other nasty tools that make Windows and your browsers unresponsive and do stuff you never wanted it to do.

If you don't install this for yourself it's for your parents, brothers and sisters outside of IT and your extended family as it helps them keep you away. It's like the apple in the old saying.

Unchecky does one thing. It unchecks the checkboxes that install all kinds of "extra's". And that makes it one of the required tools in my tasktray.

Lastpass
With all the information breaches, SSL Bugs and phishing out there, strong passwords and different ones for each site are a must. I've always prided myself in being able to remember a lot of phone numbers, but the sheer amount of passwords nowadays is just too much to either remember or keep secure.

So I trust in lastpass. And in Yubikey... and pray they'll never be compromised. Their security model ensures that your password is never sent over the wire and they use very strong security with lots of cycles to slow down anyone who wants to brute-force your storage.

Their apps are available for all platforms and they offer a plugin to integrate into your webbrowsers. The plugin is not the most beautiful in the world, but it does what it is supposed to do. They've been improving the looks quite extensively lately, so I'll keep my fingers crossed.

Controlled Vocabulary
I'm not sure how many email-lists you are still on, I understand they're a bit a thing of the past with companies moving to Yammer, Slack, HipChat and other services. Yet I find myself on a mailing list for Microsoft ALM specialists, The ALM Rangers, Scrum.org trainers and multiple beta programs.

Controlled Vocabulary is a tool that helps in categorizing email with tags so others can route your emails based on rules. It requires some discipline from all people on the list, so it may not work for yours, but if people use it correctly it's a great way to separate the important messages from the less important ones. Not sure about your mailbox, but I generally receive 100's of emails a day and spending time on the right ones is paramount to a decent productivity

Paint .NET
This little free paint replacement with enough power to do simple image manipulation is powerful enough for many of the small things I do with images while developing and for presentations. I sometimes long for the power of Photoshop, but the price has always felt prohibitive. Now with the Creative Cloud offer, I may switch, as upgrading my old Lightroom 4.0 license will cost me as much as a year's worth of both Photoshop CS and Lightroom.

Until then, Paint .NET will be my go-to tool for small image work.

Atom (or Visual Studio Code)
Notepad is sooooooo 1993... In comes Atom. Free alternative to Sublime Text and the basis for Visual Studio Code. It's a multi tab text editor with all the features you could wish for. From extensibility to syntax highlighting to intelligent XML auto-suggestions.

Other stuff
Other tools, more in the development space, haven't changed much since my last tools of choice posts (Helpful Visual Studio Add-ins, My must-have extensions for Visual Studio 2013)

  • Visual Studio 2013 Update 5 RC
  • Visual Studio 2015 RC
  • Resharper 9.1.1
  • Visual NDepend 5
  • Reflector .NET 8
  • Team Foundation Server 2015 RC
  • Team Foundation Server Power Tools 2013 (waiting for the 2015 release)
  • SourceTree (for more advanced git trickery)
  • PoSH Git (for easier git command lines)
And the usual bunch of tools:
  • Google Chrome and Drive
  • OneDrive
  • Firefox
  • Skype

What can I say about these.

Temporarily bypass Bitlocker encryption requirement for removable devices

2015-05-01

Microsoft allows a system administrator to set a policy that requires the users to enable Bitlocker encyption on any device before it can be written to. This is a pretty foolproof system to ensure that company data is always encrypted (except that you can always turn off encryption on a device, which will decrypt (not destroy) the data.

It's pretty simple in it's use and only mildly frustrating as you're waiting for the device's first encryption (it can take quite a while on a 1TB portable drive).

Except when you want to put something on your Kindle, old iPod Touch or in my case today on a USB flash drive in order to make it UEFI boot compatible.

Luckily it's quite easy to temporarily (until the policy gets refreshed) disable this through a small registry tweak (which requires you to run as local administrator).

Simply import the following to turn off the policy check:

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Policies\Microsoft\FVE]
"RDVDenyWriteAccess"=dword:00000000

Import this snippet to revert back to the secure state:

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Policies\Microsoft\FVE]
"RDVDenyWriteAccess"=dword:00000001

This is quite probably a breach in the security policy of your company. Use at your own risk.

Staged execution of unit tests on Team Build

2015-01-19

When running Unit Tests in your build system, you may want to first run the most important suite, the one that should never fail, the ones that are currently being changed, finally the regression suite and integration tests that may be slower to execute.

Team Build supports this feature, though many probably never knew that this was in the system since the first release of the Workflow based Team Build 2010.

In your build definition you can easily add multiple test runs, and for each test run define which tests should run. Not a fixed list of tests (a vsmdi test list), but a dynamic list based on attributes of the test.

The following steps will take you through the basic gist to get this working on your Team Build instance.

 

Most Reading

Archives