{
  "path": "/posts/tfs-2012-net-45-and-c-6",
  "site": "at://did:plc:yy3apqjlms24kso7ahn7lbmb/site.standard.publication/3mova7c4nho2b",
  "tags": [
    "c#",
    "asp.net",
    "azure devops"
  ],
  "$type": "site.standard.document",
  "title": "TFS 2012, .NET 4.5 and C# 6",
  "description": "Use C# 6 features on .NET 4.5 with Visual Studio 2015, set MSBuild Arguments and install Microsoft.Net.Compilers on the old build server.",
  "publishedAt": "2016-02-01T00:00:00.000Z",
  "textContent": "So, you want to use C6 language features and you’re working on an older project that’s still rocking .NET 4.5. Well, with some caveats, you can.\n\n\n\nThe new compiler will compile targeting older framework versions. Well that’s all lovely; let’s all go home.\n\nNow. What say you’ve got an old, old build server? It’s TFS 2012 Update 2, creaking away, still glad to alive and kind of wondering why it hasn’t been upgraded or retired. This is where you want to compile .NET 4.5 from C6. Well it can be done. Here’s how it’s done:\n\n1. Install Visual Studio 2015 on the build server (I’m told this can be achieved using Microsoft Build Tools 2015 but I haven’t tried it myelf so caveat emptor)\n2. set the MSBuild Arguments in the build definition to /p:VisualStudioVersion=14.0 (i.e. Visual Studio 2015 mode)\n\n3. in each project that uses C6 syntax, install the NuGet package Microsoft.Net.Compilers with a quick install-package Microsoft.Net.Compilers\n\nThat’s it; huzzah! String interpolation here I come…",
  "canonicalUrl": "https://johnnyreilly.com/posts/tfs-2012-net-45-and-c-6"
}