1
votes

I just created a build on Visual Studio Team Services. My buid steps are: 1. Nuget Installer 2. npm install 3. Gulp 4. Visual studio build

Steps 1 through 3 go work fine. As you can see below, the nuget packages are restored. However, the actual build process fails saying "Error : This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them.". It does not give me details about which packages were missing. My solution has multiple projects and all of them fail. When I manually check their packages.config files, the listed packages are already showing successful in Nuget Installer step.

2016-03-30T21:37:17.7879368Z Set workingFolder to default: C:\LR\MMS\Services\Mms\TaskAgentProvisioner\Tools\agents\1.97.1\tasks\NuGetInstaller\0.1.21 
2016-03-30T21:37:17.9138636Z Executing the powershell script: C:\LR\MMS\Services\Mms\TaskAgentProvisioner\Tools\agents\1.97.1\tasks\NuGetInstaller\0.1.21\NuGetInstaller.ps1 
2016-03-30T21:37:18.5920842Z C:\LR\MMS\Services\Mms\TaskAgentProvisioner\Tools\agents\1.97.1\agent\worker\tools\NuGet.exe restore "C:\a\1\s\ACDirectory\ACDirectory.sln"  -NonInteractive 
2016-03-30T21:37:20.2128258Z MSBuild auto-detection: using msbuild version '14.0' from 'C:\Program Files (x86)\MSBuild\14.0\bin'. 
2016-03-30T21:37:20.6570793Z Restoring NuGet package Antlr.3.4.1.9004. 
2016-03-30T21:37:20.6580785Z Restoring NuGet package bootstrap.3.3.5. 
2016-03-30T21:37:20.7350786Z Restoring NuGet package Bootstrap-3-Typeahead.3.1.1. 
2016-03-30T21:37:20.7360787Z Restoring NuGet package Castle.Core.3.2.0. 
2016-03-30T21:37:20.7370790Z Restoring NuGet package elmah.1.2.2. 
2016-03-30T21:37:20.7370790Z Restoring NuGet package elmah.corelibrary.1.2.2. 
2016-03-30T21:37:20.7380788Z Restoring NuGet package Glimpse.1.8.6.
2016-03-30T21:37:20.7390789Z Restoring NuGet package Glimpse.Ado.1.7.3. 
2016-03-30T21:37:20.7400790Z Restoring NuGet package Glimpse.AspNet.1.8.0. 
2016-03-30T21:37:20.7400790Z Restoring NuGet package Glimpse.Mvc5.1.5.3. 
2016-03-30T21:37:20.7400790Z Restoring NuGet package Glimpse.Ninject.0.9.0. 
2016-03-30T21:37:20.7410791Z Restoring NuGet package Handlebars.Net.1.5.3. 
2016-03-30T21:37:20.7420778Z Restoring NuGet package jQuery.2.1.4. 
2016-03-30T21:37:20.7420778Z Restoring NuGet package jQuery.Validation.1.11.1. 
2016-03-30T21:37:20.7430789Z Restoring NuGet package Microsoft.AspNet.Mvc.5.2.3. 
2016-03-30T21:37:20.7440785Z Restoring NuGet package Microsoft.AspNet.Razor.3.2.3. 
2016-03-30T21:37:21.2976541Z Adding package 'elmah.1.2.2' to folder 'C:\a\1\s\ACDirectory\packages' 
2016-03-30T21:37:21.3206242Z Added package 'elmah.1.2.2' to folder 'C:\a\1\s\ACDirectory\packages' 
2016-03-30T21:37:21.3226250Z Restoring NuGet package Microsoft.AspNet.Web.Optimization.1.1.3. 
2016-03-30T21:37:22.1616313Z Adding package 'Bootstrap-3-Typeahead.3.1.1' to folder 'C:\a\1\s\ACDirectory\packages' 
2016-03-30T21:37:23.1577504Z Adding package 'Handlebars.Net.1.5.3' to folder 'C:\a\1\s\ACDirectory\packages' 
2016-03-30T21:37:23.1597507Z Adding package 'Glimpse.Mvc5.1.5.3' to folder 'C:\a\1\s\ACDirectory\packages' 
2016-03-30T21:37:23.2021806Z Adding package 'Microsoft.AspNet.Web.Optimization.1.1.3' to folder 'C:\a\1\s\ACDirectory\packages' 
2016-03-30T21:37:23.2081748Z Adding package 'Glimpse.Ado.1.7.3' to folder 'C:\a\1\s\ACDirectory\packages' 
2016-03-30T21:37:23.2121746Z Added package 'Handlebars.Net.1.5.3' to folder 'C:\a\1\s\ACDirectory\packages' 
2016-03-30T21:37:23.2161746Z Adding package 'Antlr.3.4.1.9004' to folder 'C:\a\1\s\ACDirectory\packages' 
2016-03-30T21:37:23.2191750Z Restoring NuGet package Microsoft.AspNet.WebPages.3.2.3. 
2016-03-30T21:37:23.2281754Z Added package 'Bootstrap-3-Typeahead.3.1.1' to folder 'C:\a\1\s\ACDirectory\packages' 
2016-03-30T21:37:23.2321829Z Adding package 'Glimpse.Ninject.0.9.0' to folder 'C:\a\1\s\ACDirectory\packages' 
2016-03-30T21:37:23.2401751Z Restoring NuGet package Microsoft.jQuery.Unobtrusive.Ajax.3.2.3. 
2016-03-30T21:37:23.2411755Z Added package 'Microsoft.AspNet.Web.Optimization.1.1.3' to folder 'C:\a\1\s\ACDirectory\packages' 
2016-03-30T21:37:23.2451754Z Restoring NuGet package Microsoft.jQuery.Unobtrusive.Validation.3.2.2. 
2016-03-30T21:37:23.2651757Z Added package 'Glimpse.Mvc5.1.5.3' to folder 'C:\a\1\s\ACDirectory\packages' 
2016-03-30T21:37:23.2701752Z Restoring NuGet package Microsoft.Web.Infrastructure.1.0.0. 
2016-03-30T21:37:23.2721754Z Adding package 'elmah.corelibrary.1.2.2' to folder 'C:\a\1\s\ACDirectory\packages' 
2016-03-30T21:37:23.3071730Z Added package 'Glimpse.Ninject.0.9.0' to folder 'C:\a\1\s\ACDirectory\packages' 
2016-03-30T21:37:23.3111743Z Added package 'Glimpse.Ado.1.7.3' to folder 'C:\a\1\s\ACDirectory\packages' 
2016-03-30T21:37:23.3131753Z Adding package 'Microsoft.AspNet.Razor.3.2.3' to folder 'C:\a\1\s\ACDirectory\packages' 
2016-03-30T21:37:23.3171747Z Restoring NuGet package Modernizr.2.6.2. 
2016-03-30T21:37:23.3181751Z Restoring NuGet package Microsoft.Web.RedisOutputCacheProvider.1.6.5. 
2016-03-30T21:37:23.3235829Z Adding package 'jQuery.Validation.1.11.1' to folder 'C:\a\1\s\ACDirectory\packages' 
2016-03-30T21:37:23.3721754Z Added package 'elmah.corelibrary.1.2.2' to folder 'C:\a\1\s\ACDirectory\packages' 
2016-03-30T21:37:23.3851742Z Restoring NuGet package Newtonsoft.Json.7.0.1. 
2016-03-30T21:37:23.3861765Z Adding package 'Glimpse.AspNet.1.8.0' to folder 'C:\a\1\s\ACDirectory\packages' 
2016-03-30T21:37:23.3881762Z Added package 'jQuery.Validation.1.11.1' to folder 'C:\a\1\s\ACDirectory\packages' 

Error log:

2016-03-30T21:19:24.6463970Z ##[error]ACDirectory\ACDirectory\ACDirectory.csproj(534,5): Error : This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them.  For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is C:\a\1\s\ACDirectory\\.nuget\NuGet.targets.    
2016-03-30T21:19:24.6463970Z      1>Project "C:\a\1\s\ACDirectory\ACDirectory.sln" (1) is building "C:\a\1\s\ACDirectory\ACDirectory\ACDirectory.csproj" (3) on node 1 (default targets).    
2016-03-30T21:19:24.6483982Z      3>C:\a\1\s\ACDirectory\ACDirectory\ACDirectory.csproj(534,5): error : This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them.  For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is C:\a\1\s\ACDirectory\\.nuget\NuGet.targets. 
2016-03-30T21:19:24.6683975Z ##[error]ACDirectory\ACDirectory.Model\ACDirectory.Model.csproj(136,5): Error : This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them.  For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is C:\a\1\s\ACDirectory\\.nuget\NuGet.targets. 
2016-03-30T21:19:24.6683975Z      1>Project "C:\a\1\s\ACDirectory\ACDirectory.sln" (1) is building "C:\a\1\s\ACDirectory\ACDirectory.Model\ACDirectory.Model.csproj" (2) on node 2 (default targets). 
2016-03-30T21:19:24.6693966Z      2>C:\a\1\s\ACDirectory\ACDirectory.Model\ACDirectory.Model.csproj(136,5): error : This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them.  For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is C:\a\1\s\ACDirectory\\.nuget\NuGet.targets. 
2016-03-30T21:19:24.6773979Z      3>_CleanRecordFileWrites: 
2016-03-30T21:19:24.6793970Z          Creating directory "obj\Release\". 
2016-03-30T21:19:24.6913977Z      3>Done Building Project "C:\a\1\s\ACDirectory\ACDirectory\ACDirectory.csproj" (default targets) -- FAILED. 
2016-03-30T21:19:24.6923970Z        The target "_ConvertPdbFiles" listed in a BeforeTargets attribute at "C:\Program Files (x86)\MSBuild\12.0\Microsoft.Common.targets\ImportAfter\Xamarin.Common.targets (34,37)" does not exist in the project, and will be ignored. 
2016-03-30T21:19:24.6933982Z        The target "_CollectPdbFiles" listed in an AfterTargets attribute at "C:\Program Files (x86)\MSBuild\12.0\Microsoft.Common.targets\ImportAfter\Xamarin.Common.targets (34,70)" does not exist in the project, and will be ignored. 
2016-03-30T21:19:24.6953974Z        The target "_CollectMdbFiles" listed in a BeforeTargets attribute at "C:\Program Files (x86)\MSBuild\12.0\Microsoft.Common.targets\ImportAfter\Xamarin.Common.targets (40,38)" does not exist in the project, and will be ignored. 
2016-03-30T21:19:24.6963978Z        The target "_CopyMdbFiles" listed in an AfterTargets attribute at "C:\Program Files (x86)\MSBuild\12.0\Microsoft.Common.targets\ImportAfter\Xamarin.Common.targets (40,71)" does not exist in the project, and will be ignored. 
2016-03-30T21:19:24.7123978Z      2>_CleanRecordFileWrites: 
2016-03-30T21:19:24.7943968Z          Creating directory "obj\Release\". 
2016-03-30T21:19:24.8263976Z      2>Done Building Project "C:\a\1\s\ACDirectory\ACDirectory.Model\ACDirectory.Model.csproj" (default targets) -- FAILED. 
2016-03-30T21:19:24.8363981Z ##[error]ACDirectory\ACDirectory.SqlDAL\ACDirectory.SqlDAL.csproj(125,5): Error : This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them.  For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is C:\a\1\s\ACDirectory\\.nuget\NuGet.targets. 
2016-03-30T21:19:24.8373978Z      1>Project "C:\a\1\s\ACDirectory\ACDirectory.sln" (1) is building "C:\a\1\s\ACDirectory\ACDirectory.SqlDAL\ACDirectory.SqlDAL.csproj" (4) on node 1 (default targets). 
2016-03-30T21:19:24.8403979Z      4>C:\a\1\s\ACDirectory\ACDirectory.SqlDAL\ACDirectory.SqlDAL.csproj(125,5): error : This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them.  For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is C:\a\1\s\ACDirectory\\.nuget\NuGet.targets. 
1

1 Answers

2
votes

Try to Unload Project and check .csproj file, to see whether there is a similar snippet below:

<Import Project="$(SolutionDir)\.nuget\NuGet.targets" Condition="Exists('$(SolutionDir)\.nuget\NuGet.targets')" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
  <PropertyGroup>
    <ErrorText>This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them.  For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
  </PropertyGroup>
  <Error Condition="!Exists('$(SolutionDir)\.nuget\NuGet.targets')" Text="$([System.String]::Format('$(ErrorText)', '$(SolutionDir)\.nuget\NuGet.targets'))" />
</Target>

Remove the snippet if it's there, you need to migrate MSBuild-Integrated solutions to use Automatic Package Restore.