Adding GitHub upstream remote in Visual Studio

Forking and opening a GitHub repo in Visual Studio is a matter of seconds. But how to keep your fork up-to-date easily, all within the Team Explorer window? All you need to do is to add the upstream remote.

Navigate to your cloned fork in Team Explorer, click the title bar to reveal repository menu and select Settings.


In the opened page select Repository Settings and then find the Remotes section at the bottom:


Click the Add link to open the Add Remote dialog window. Here fill out:

  • Name – upstream
  • Fetch – URL of the original GitHub repository you forked
  • Push – same as Fetch
  • Push matches fetch – leave checked
Adding upstream remote
Adding upstream remote

Confirm with Save and that’s almost it. Now we just need to do a fetch to get the current state of the upstream. Click the title of the Team Explorer window again and navigate to Sync:


And from the top menu click the Fetch link, select upstream from the dropdown menu and click Fetch. Now the branches from the repository should be available in the Branches view and you can merge the latest changes from upstream in your fork.

Tip: Force-reinstall NuGet packages

NuGet is a great package manager, but sometimes it misbehaves and packages are either not properly downloaded or are not properly included in your project. Whenever you come across this, I recommend doing a force-reinstall of all packages.

In Visual Studio go to Tools -> NuGet Package Manager -> Package Management Console . In the Package Manager Console window then enter the following command:

This will go package by package and force-reinstall them the opened solution.

If you want to force-reinstall packages only for one specific project instead of the whole solution, you can add the -ProjectName switch:


Connect(); 2017

Another year has come and with it the fourth annual on-line Microsoft Connect conference. Between 15th and 17th November you could watch the newest goodness from Microsoft for all developers on all platforms.

Two main keynotes were dedicated to intelligent cloud and building intelligent applications of the future. Let’s see what Scott Guthrie (of course in his favourite red polo shirt) and other speakers have unveiled. Continue reading “Connect(); 2017”

Using custom nuget.exe in VSTS build process

Soon after the release of Visual Studio 2017, the Visual Studio Team Services team has added a Hosted VS2017 build agent that has support for all the latest and greatest technologies. Unfortunately although the build task with Visual Studio 2017 is itself present, the newest version of NuGet wasn’t added, yet. Fortunately, it is possible to use a custom nuget.exe to circumvent this issue and be able to restore packages for project using the new csproj format with <PackageReference>. Continue reading “Using custom nuget.exe in VSTS build process”

Adding Hyper-V-less boot entry with PowerShell

Developers often encounter the need to run virtual machines using VirtualBox and Hyper-V-based mobile emulators on the same machine (for example Windows Mobile or Visual Studio Android Emulator). Unfortunately only one of the two can be enabled at once. The easiest solution is to create two boot entries and disable Hyper-V in one of them.

CMD way

The awesome Scott Hanselman provided a quick command line solution in one of his blogposts.

As part of creating a Chocolatey based PowerShell install script for my most used tools after computer reinstall, I wanted to make this automatic and preferably skip the copy-paste step.

PowerShell script

The script is very simple:

First line of the script runs the bcdedit  tool and create a copy of the current boot entry. The result is a string in the following form:

We need to parse out the identifier enclosed between curly brackets. This is just the job for regular expressions on the second line of the script. The matches are stored in the   $matches  variable.

Finally we can use the identifier to modify the boot entry to disable Hyper-V on the third line.

And that’s it! Pretty simple but convenient. You can simply run the script and the new Hyper-V-less boot entry will be created for you automatically. Be sure to run the script with administrator permissions.

You can download the script here.