title: Error building dapper in a .net v5.4 project on visual studio team services hosted build agent
body: <p>I recently set up a very basic .net web project and used dapper in my repository to access a database. It works and builds with no errors on my local computer, but when i attempt to build on VSTS, i get an error saying that certain packages are not compatible with .net framework v5.4 or v5.0 (tried a few different frameworks in an attempt to get it to build.)</p>
  
  <p>Here's the project.json file in question that contains dapper. This builds and restores without any issues locally on my computer:</p>
  
  <pre><code>      {
      "version": "1.0.0-*",
      "description": "ProjectPOC.Core.Implementations Class Library",
      "authors": [ "CBergeron" ],
      "tags": [ "" ],
      "projectUrl": "",
      "licenseUrl": "",
      "dependencies": {
        "ProjectPOC.Core.Infrastructure": "",
        "ProjectPOC.Core.Models": "",
        "Microsoft.Extensions.OptionsModel": "1.0.0-rc1-final",
        "Dapper": "1.50.0-beta9"
      },
      "frameworks": {
        "net451": {
          "dependencies": {
  
          }
        },
        "dotnet5.4": {
          "dependencies": {
            "Microsoft.CSharp": "4.0.1-beta-23516",
            "System.Collections": "4.0.11-beta-23516",
            "System.Linq": "4.0.1-beta-23516",
            "System.Runtime": "4.0.21-beta-23516",
            "System.Threading": "4.0.11-beta-23516"
          }
        }
      }
    }
  </code></pre>
  
  <p>When This project is built on the VSTS hosted build agent, i'm running the preinstall.ps1 script that's commonly being used here:</p>
  
  <pre><code># bootstrap DNVM into this session.
    "bootstrapping dnvminstall..."
    &amp;{$Branch='dev';iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/aspnet/Home/dev/dnvminstall.ps1'))}
     "finished bootstrapping"
  
     "Loading global.json"
    # load up the global.json so we can find the DNX version
    $globalJson = Get-Content -Path $PSScriptRoot\global.json -Raw -ErrorAction Ignore | ConvertFrom-Json -ErrorAction Ignore
    "finished loading global.json"  
  
  
    if($globalJson)
    {
  
        $dnxVersion = $globalJson.sdk.version
      "setting DNX version.. to $dnxVersion "
    }
    else
    {
        Write-Warning "Unable to locate global.json to determine using 'latest'"
        $dnxVersion = "latest"
    }
  
    # install DNX
    # only installs the default (x86, clr) runtime of the framework.
    # If you need additional architectures or runtimes you should add additional calls
    # ex: &amp; $env:USERPROFILE\.dnx\bin\dnvm install $dnxVersion -r coreclr
    "installing DNX"
    &amp; $env:USERPROFILE\.dnx\bin\dnvm install $dnxVersion -Persistent
    #&amp; $env:USERPROFILE\.dnx\bin\dnvm install $dnxVersion -r clr
    #&amp; $env:USERPROFILE\.dnx\bin\dnvm install $dnxVersion -r coreclr
    #&amp; $env:USERPROFILE\.dnx\bin\dnvm use $dnxVersion
    &amp; $env:USERPROFILE\.dnx\bin\dnvm list
      "finished DNX install  "
  
  
      "DNU restoring....."
     # run DNU restore on all project.json files in the src folder including 2&gt;1 to redirect stderr to stdout for badly behaved tools
    Get-ChildItem -Path $PSScriptRoot\src -Filter project.json -Recurse | ForEach-Object { &amp; dnu restore $_.FullName 2&gt;1 }
  
    #dnu restore
    "finsihed DNU restore"  
  </code></pre>
  
  <p>This script is installing the following dnx based on the build logs, which matches my dnvm listing on my local machine:</p>
  
  <pre><code>2016-05-19T03:45:19.1014995Z installing DNX
      2016-05-19T03:45:19.9042850Z Downloading dnx-clr-win-x86.1.0.0-rc1-update2 from https://www.nuget.org/api/v2
      2016-05-19T03:45:22.7176602Z Installing to C:\Users\buildguest\.dnx\runtimes\dnx-clr-win-x86.1.0.0-rc1-update2
      2016-05-19T03:45:22.7766619Z Adding C:\Users\buildguest\.dnx\runtimes\dnx-clr-win-x86.1.0.0-rc1-update2\bin to process PATH
      2016-05-19T03:45:22.8456619Z Adding C:\Users\buildguest\.dnx\runtimes\dnx-clr-win-x86.1.0.0-rc1-update2\bin to user PATH
      2016-05-19T03:45:22.8826599Z Native image generation (ngen) is skipped. Include -Ngen switch to turn on native image generation to improve application startup time.
      2016-05-19T03:45:23.0276682Z Active Version           Runtime Architecture OperatingSystem Alias
      2016-05-19T03:45:23.0346603Z ------ -------           ------- ------------ --------------- -----
      2016-05-19T03:45:23.0356615Z   *    1.0.0-rc1-update2 clr     x86          win                  
      2016-05-19T03:45:23.0586614Z finished DNX install  
      2016-05-19T03:45:23.0596622Z DNU restoring.....
      2016-05-19T03:45:23.2796607Z Microsoft .NET Development Utility Clr-x86-1.0.0-rc1-16609
      2016-05-19T03:45:23.4785866Z   GET https://api.nuget.org/v3/index.json
      2016-05-19T03:45:23.5821917Z   OK https://api.nuget.org/v3/index.json 123ms
      2016-05-19T03:45:23.6261910Z   GET https://www.myget.org/F/aspnetvnext/api/v2/
      2016-05-19T03:45:24.4737562Z   OK https://www.myget.org/F/aspnetvnext/api/v2/ 847ms
      2016-05-19T03:45:24.4787560Z   GET https://www.myget.org/F/aspnetmaster/
      2016-05-19T03:45:25.1793928Z   OK https://www.myget.org/F/aspnetmaster/ 700ms
  </code></pre>
  
  <p>After it finishes the restore from nuget, during the build it throws errors like this for the package library with dapper in it and anything that references it:</p>
  
  <pre><code>       Unable to resolve dependency System.Collections.NonGeneric 4.0.1-rc2-24027
   ...
   2016-05-19T03:47:01.3562201Z ##[error]Platform\POC\ProjectPOC.Web.API\src\ProjectPOC.Core.Implementations\project.json(0,0): Error NU1002: The dependency System.Collections.NonGeneric 4.0.1-rc2-24027 in project ProjectPOC.Core.Implementations does not support framework .NETPlatform,Version=v5.4.
   2016-05-19T03:47:01.3602187Z      5&gt;C:\a\1\s\Platform\POC\ProjectPOC.Web.API\src\ProjectPOC.Core.Implementations\project.json : error NU1002: The dependency System.Collections.NonGeneric 4.0.1-rc2-24027 in project ProjectPOC.Core.Implementations does not support framework .NETPlatform,Version=v5.4. [C:\a\1\s\Platform\POC\ProjectPOC.Web.API\src\ProjectPOC.Core.Implementations\ProjectPOC.Core.Implementations.xproj]
  </code></pre>
  
  <p>Again this is building, running, deploying to azure, etc flawlessly from my local machine in VS2015, so i feel like it has something to do with the hosted build agent and it's dnx/dnvm/nuget setup. Is there something that i need to add to the build agent or something i need to do to the dnvm/nuget install to get the correct versions of everything? I also uploaded my nuget.config to the build agent and that also didn't help. I can provide more of the logs on request. </p>
  
  <p>my local dnvm list looks like this:</p>
  
  <pre><code>  Active Version           Runtime Architecture OperatingSystem Alias
    ------ -------           ------- ------------ --------------- -----
           1.0.0-beta8       clr     x64          win
           1.0.0-beta8       coreclr x64          win
           1.0.0-beta8       coreclr x86          win
           1.0.0-rc1-update1 clr     x64          win
           1.0.0-rc1-update1 clr     x86          win
           1.0.0-rc1-update1 coreclr x64          win
           1.0.0-rc1-update1 coreclr x86          win
      *    1.0.0-rc1-update2 clr     x86          win             default
  </code></pre>
  
  <p>Thanks in advance if anyone can provide any help with this or has run into a similar issue before with the new .net stuff</p>