Why?
SourceLink gets a list of files to source index from MSBuild project files. As I mentioned in my last post, the $(VisualStudioVersion) is used by Visual Studio 2013 and higher versions after they decided to bundle MSBuild. Unfortunately, the MSBuild libraries bundled with .NET 4 do not set that property correctly. This makes sense, since they predate VS 2013. The libraries included with VS could be used, but I do not know how to reference the latest version. Creating and using this NuGet package solves the problem.Building MSBuild
Building and packaging the open source MSBuild package ended up being more work than I thought it would be. Here is a list of all the changes, most dealing with the renaming of the assemblies. A big thanks to AppVeyor for proving the build service. Build #50 on AppVeyor ended up being the official build for the published package. I created a build.ps1 PowerShell script. Here the final part of that build running on AppVeyor:build.ps1 Highlights
There is a lot going on in the 75 line build.ps1 file. It probably deserves a blog post. Here I'm going to highlight using SourceLink.exe to do the source indexing and using Paket to build the NuGet package.Here I install SourceLink.exe via Chocolatey.
SourceLink.exe index is run on each of the project files after the are built. This source indexes each of the pdb files that were built. I'm making use of iex, an alias for Invoke-Expression, which simply lets me create the command dynamically.
Here is the paket command and paket.template I used, although it looks like a couple of tabs snuck in along with a misspelling. The important stuff is correct like the dependency on Tpl.Dataflow.