Nuget Packages Restore issue in Bamboo with MSBuild - asp.net-mvc

I am using Bamboo and MSBuild and enabled restore packages.
When I run it it does not restore all pacakges when I see logs it restore some pacakges but does not all projects pacakges in solution... is there anything I need to fix in MS Build script?
Full Error Log:
http://justpaste.it/oq2p
Error Log:
02-Nov-2015 10:08:55 Infrastructure\InMemoryMultipartStreamProvider.cs(14,52): error CS0246: The type or namespace name 'MultipartStreamProvider' could not be found (are you missing a using directive or an assembly reference?) [C:\Users\Administrator\bamboo-home\xml-data\build-dir\API-STAG-JOB1\SmartDesk.BusinessObjects\SmartDesk360.BusinessObjects.csproj]
02-Nov-2015 10:08:55 Infrastructure\InMemoryMultipartStreamProvider.cs(30,32): error CS0115: 'InMemoryMultipartStreamProvider.GetStream(HttpContent, HttpContentHeaders)': no suitable method found to override [C:\Users\Administrator\bamboo-home\xml-data\build-dir\API-STAG-JOB1\SmartDesk.BusinessObjects\SmartDesk360.BusinessObjects.csproj]
02-Nov-2015 10:08:55 Infrastructure\InMemoryMultipartStreamProvider.cs(41,36): error CS0115: 'InMemoryMultipartStreamProvider.ExecutePostProcessingAsync()': no suitable method found to override [C:\Users\Administrator\bamboo-home\xml-data\build-dir\API-STAG-JOB1\SmartDesk.BusinessObjects\SmartDesk360.BusinessObjects.csproj]
02-Nov-2015 10:08:55 Done Building Project "C:\Users\Administrator\bamboo-home\xml-data\build-dir\API-STAG-JOB1\SmartDesk.BusinessObjects\SmartDesk360.BusinessObjects.csproj" (default targets) -- FAILED.
02-Nov-2015 10:08:55 Project "C:\Users\Administrator\bamboo-home\xml-data\build-dir\API-STAG-JOB1\API.SmartDesk360.com\SmartDesk360.API.csproj" (2) is building "C:\Users\Administrator\bamboo-home\xml-data\build-dir\API-STAG-JOB1\SmartDesk360.Core\SmartDesk360.Core.csproj" (6) on node 1 (default targets).
02-Nov-2015 10:08:55 RestorePackages:
02-Nov-2015 10:08:55 "C:\Users\Administrator\bamboo-home\xml-data\build-dir\API-STAG-JOB1\.nuget\NuGet.exe" install "C:\Users\Administrator\bamboo-home\xml-data\build-dir\API-STAG-JOB1\SmartDesk360.Core\packages.config" -source "" -NonInteractive -RequireConsent -solutionDir "C:\Users\Administrator\bamboo-home\xml-data\build-dir\API-STAG-JOB1\ "
02-Nov-2015 10:08:55 Restoring NuGet packages...
02-Nov-2015 10:08:55 To prevent NuGet from downloading packages during build, open the Visual Studio Options dialog, click on the Package Manager node and uncheck 'Allow NuGet to download missing packages'.
02-Nov-2015 10:08:55 All packages listed in packages.config are already installed.
02-Nov-2015 10:08:55 Project "C:\Users\Administrator\bamboo-home\xml-data\build-dir\API-STAG-JOB1\SmartDesk360.Core\SmartDesk360.Core.csproj" (6) is building "C:\Users\Administrator\bamboo-home\xml-data\build-dir\API-STAG-JOB1\SmartDesk360.DataLayer\SmartDesk360.DataLayer.csproj" (7) on node 1 (default targets).
02-Nov-2015 10:08:55 RestorePackages:
02-Nov-2015 10:08:55 "C:\Users\Administrator\bamboo-home\xml-data\build-dir\API-STAG-JOB1\.nuget\NuGet.exe" install "C:\Users\Administrator\bamboo-home\xml-data\build-dir\API-STAG-JOB1\SmartDesk360.DataLayer\packages.config" -source "" -NonInteractive -RequireConsent -solutionDir "C:\Users\Administrator\bamboo-home\xml-data\build-dir\API-STAG-JOB1\ "
02-Nov-2015 10:08:55 Restoring NuGet packages...
02-Nov-2015 10:08:55 To prevent NuGet from downloading packages during build, open the Visual Studio Options dialog, click on the Package Manager node and uncheck 'Allow NuGet to download missing packages'.
02-Nov-2015 10:08:55 All packages listed in packages.config are already installed.
02-Nov-2015 10:08:55 Done Building Project "C:\Users\Administrator\bamboo-home\xml-data\build-dir\API-STAG-JOB1\SmartDesk360.DataLayer\SmartDesk360.DataLayer.csproj" (default targets) -- FAILED.
02-Nov-2015 10:08:55 Project "C:\Users\Administrator\bamboo-home\xml-data\build-dir\API-STAG-JOB1\SmartDesk360.Core\SmartDesk360.Core.csproj" (6) is building "C:\Users\Administrator\bamboo-home\xml-data\build-dir\API-STAG-JOB1\SmartDesk360.FileManager\SmartDesk360.FileManager.csproj" (8) on node 1 (default targets).
02-Nov-2015 10:08:55 RestorePackages:
02-Nov-2015 10:08:55 "C:\Users\Administrator\bamboo-home\xml-data\build-dir\API-STAG-JOB1\.nuget\NuGet.exe" install "C:\Users\Administrator\bamboo-home\xml-data\build-dir\API-STAG-JOB1\SmartDesk360.FileManager\packages.config" -source "" -NonInteractive -RequireConsent -solutionDir "C:\Users\Administrator\bamboo-home\xml-data\build-dir\API-STAG-JOB1\ "
02-Nov-2015 10:08:56 Restoring NuGet packages...
02-Nov-2015 10:08:56 To prevent NuGet from downloading packages during build, open the Visual Studio Options dialog, click on the Package Manager node and uncheck 'Allow NuGet to download missing packages'.
02-Nov-2015 10:08:56 All packages listed in packages.config are already installed.
02-Nov-2015 10:08:56 Done Building Project "C:\Users\Administrator\bamboo-home\xml-data\build-dir\API-STAG-JOB1\SmartDesk360.FileManager\SmartDesk360.FileManager.csproj" (default targets) -- FAILED.
02-Nov-2015 10:08:56 Project "C:\Users\Administrator\bamboo-home\xml-data\build-dir\API-STAG-JOB1\SmartDesk360.Core\SmartDesk360.Core.csproj" (6) is building "C:\Users\Administrator\bamboo-home\xml-data\build-dir\API-STAG-JOB1\SmartDesk360.Mailer\SmartDesk360.Mailer.csproj" (9) on node 1 (default targets).
02-Nov-2015 10:08:56 GenerateTargetFrameworkMonikerAttribute:
02-Nov-2015 10:08:56 Skipping target "GenerateTargetFrameworkMonikerAttribute" because all output files are up-to-date with respect to the input files.
02-Nov-2015 10:08:56 CoreCompile:
02-Nov-2015 10:08:56 Skipping target "CoreCompile" because all output files are up-to-date with respect to the input files.
02-Nov-2015 10:08:56 CopyFilesToOutputDirectory:
02-Nov-2015 10:08:56 SmartDesk360.Mailer -> C:\Users\Administrator\bamboo-home\xml-data\build-dir\API-STAG-JOB1\SmartDesk360.Mailer\bin\Debug\SmartDesk360.Mailer.dll
02-Nov-2015 10:08:56 Done Building Project "C:\Users\Administrator\bamboo-home\xml-data\build-dir\API-STAG-JOB1\SmartDesk360.Mailer\SmartDesk360.Mailer.csproj" (default targets).
02-Nov-2015 10:08:56 Done Building Project "C:\Users\Administrator\bamboo-home\xml-data\build-dir\API-STAG-JOB1\SmartDesk360.Core\SmartDesk360.Core.csproj" (default targets) -- FAILED.
02-Nov-2015 10:08:56 Done Building Project "C:\Users\Administrator\bamboo-home\xml-data\build-dir\API-STAG-JOB1\API.SmartDesk360.com\SmartDesk360.API.csproj" (default targets) -- FAILED.
02-Nov-2015 10:08:56 Project "C:\Users\Administrator\bamboo-home\xml-data\build-dir\API-STAG-JOB1\API.SmartDesk360.com.sln" (1) is building "C:\Users\Administrator\bamboo-home\xml-data\build-dir\API-STAG-JOB1\Tests.SmartDesk360.com\Tests.SmartDesk360.com.csproj" (10) on node 1 (default targets).

So if your repositories.config file contains something like this:
<?xml version="1.0" encoding="utf-8"?>
<repositories>
<repository path=".\MyCsProj\packages.config" />
</repositories>
And your MyCsProj\packages.config file looks like this:
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="SuperCoolPackage" version="4.3.2.1" targetFramework="net452" />
</packages>
Nuget is going to look for a directory like:
.\packages\SuperCoolPackage.4.3.2.1\
Regardless of whether or not there are the actual binaries in the ".\packages\SuperCoolPackage.4.3.2.1\" directory, Nuget ~thinks~/assumes they are there by the name of the folder.
So sometimes, while the folder ".\packages\SuperCoolPackage.4.3.2.1\" exists, it may not have any child-files that are the actual binaries you need.
You need to re-read the latest suggestions for storing files in source control.
https://docs.nuget.org/consume/package-restore
To promote a cleaner developer environment while also reducing
repository size, NuGet offers a Package Restore feature that will
install all referenced packages before a project is built, thereby
ensuring that all dependencies are available to a project without
requiring them to be stored in source control.
So here's what you want in source control.
.\packages\repositories.config
and NO subfolders under this ".\packages\"
Then you will run
nuget.exe restore MySolution.sln during the build process.
Because there are NO subfolders under this ".\packages\", it will download them. (and cache them locally so only the first time is really painful)
The biggest tripping point (IMHO) is having
.\packages\SuperCoolPackage.4.3.2.1\
in source control. I recommend NOT having any of these subfolders in source control, as per the nuget url I mention above.
If you have .\packages\SuperCoolPackage.4.3.2.1\ ... either remove it from source control..........or write msbuild code to delete all subfolders before running the nuget.exe restore command.

"C:\Program Files (x86)\NuGet\nuget.exe" restore ${bamboo.build.working.directory}\MySolution.sln"
I hope this will resolve issue

Related

I am migrating a project from maven to bazel and getting error

i am following the official bazel documentation for migrating from maven to bazel and used rules_jvm_external to defined external dependencies in workspace file and Build file. But I am getting the follwing error.
C:/users/kunal_visoulia/_bazel_kunal_visoulia/3f5dzdsz/external/maven/BUILD:1212:1: in deps attribute of jvm_import rule #maven//:commons_digester_commons_digester: rule '#maven//:xml_apis_xml_apis' does not exist
ERROR: Analysis of target '//:everything' failed; build aborted: Analysis of target '#maven//:commons_digester_commons_digester' failed; build aborted
INFO: Elapsed time: 724.364s
INFO: 0 processes.
FAILED: Build did NOT complete successfully (4 packages loaded, 371 targets configured)
Fetching #remotejdk11_win; Restarting.
i am using private nexus repo and also the official maven repo. Please help
I've successfully reproduced your error and found the following workaround:
Add xml-apis:xml-apis:1.4.01 and junit:junit-dep:4.9 to your
list of artifacts.
Add the version_conflict_policy = "pinned"
attribute to maven_install.
The root cause is https://github.com/bazelbuild/rules_jvm_external/issues/250. The missing dependencies are artifacts that relocated to new GAV coordinates, which the coursier resolver cannot handle yet. The general workaround is to manually add the legacy GAV coordinates into maven_install.
Specifically, xml-apis:xml-apis:2.0.2 relocated to xml-apis:xml-apis:1.0.b2 (but 1.4.0.1 wasn't relocated), and junit:junit-dep:4.9 relocated to junit:junit.

Build error for missing Nuget package even though "nuget restore" ran

I'm trying to set up a Jenkins server to build an ASP Core project. I have my Jenkins project configured to use the MSBuild from my installed Visual Studio 2017. I downloaded Nuget v5.3.1 and added it to my PATH.
My Jenkins project is configured with two build steps. The first step is to run nuget restore. The second step is "Build a Visual Studio project or solution using MSBuild" on my solution file (AspCore.sln)
When I try to build the project in Jenkins, I get the following error. However, it appears that all of the Nuget packages were downloaded successfully.
C:\Program Files\dotnet\sdk\2.1.509\Sdks\Microsoft.NET.Sdk\targets\Microsoft.PackageDependencyResolution.targets(198,5): error NETSDK1064: Package Microsoft.VisualStudio.Web.CodeGeneration, version 2.1.9 was not found. It might have been deleted since NuGet restore. Otherwise, NuGet restore might have only partially completed, which might have been due to maximum path length restrictions. [C:\Program Files (x86)\Jenkins\workspace\Windows Service Deployment\AspCore\AspCore.csproj]
Here's the full Jenkins build log.
Started by user Ben Rubin
Running as SYSTEM
Building in workspace C:\Program Files (x86)\Jenkins\workspace\Windows Service Deployment
using credential 633afff1-dea9-4aab-a44a-0a4d127afd1b
> git.exe rev-parse --is-inside-work-tree # timeout=10
Fetching changes from the remote Git repository
> git.exe config remote.origin.url git#github.com:Toreth/AspCoreTest.git # timeout=10
Fetching upstream changes from git#github.com:Toreth/AspCoreTest.git
> git.exe --version # timeout=10
using GIT_SSH to set credentials
> git.exe fetch --tags --force --progress -- git#github.com:Toreth/AspCoreTest.git +refs/heads/*:refs/remotes/origin/*
> git.exe rev-parse "refs/remotes/origin/master^{commit}" # timeout=10
> git.exe rev-parse "refs/remotes/origin/origin/master^{commit}" # timeout=10
Checking out Revision c0e95238b58d6648c51fac0a817fa5d3e60ce615 (refs/remotes/origin/master)
> git.exe config core.sparsecheckout # timeout=10
> git.exe checkout -f c0e95238b58d6648c51fac0a817fa5d3e60ce615
Commit message: "Initial commit."
> git.exe rev-list --no-walk c0e95238b58d6648c51fac0a817fa5d3e60ce615 # timeout=10
[Windows Service Deployment] $ cmd /c call C:\Windows\TEMP\jenkins4544019004588734090.bat
C:\Program Files (x86)\Jenkins\workspace\Windows Service Deployment>nuget restore
MSBuild auto-detection: using msbuild version '15.9.21.664' from 'C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\15.0\bin'.
Restoring packages for C:\Program Files (x86)\Jenkins\workspace\Windows Service Deployment\AspCore\AspCore.csproj...
GET https://api.nuget.org/v3-flatcontainer/microsoft.visualstudio.web.codegeneration.design/index.json
OK https://api.nuget.org/v3-flatcontainer/microsoft.visualstudio.web.codegeneration.design/index.json 45ms
GET https://api.nuget.org/v3-flatcontainer/microsoft.visualstudio.web.codegeneration.design/2.1.9/microsoft.visualstudio.web.codegeneration.design.2.1.9.nupkg
OK https://api.nuget.org/v3-flatcontainer/microsoft.visualstudio.web.codegeneration.design/2.1.9/microsoft.visualstudio.web.codegeneration.design.2.1.9.nupkg 31ms
GET https://api.nuget.org/v3-flatcontainer/microsoft.visualstudio.web.codegenerators.mvc/index.json
OK https://api.nuget.org/v3-flatcontainer/microsoft.visualstudio.web.codegenerators.mvc/index.json 42ms
GET https://api.nuget.org/v3-flatcontainer/microsoft.visualstudio.web.codegenerators.mvc/2.1.9/microsoft.visualstudio.web.codegenerators.mvc.2.1.9.nupkg
OK https://api.nuget.org/v3-flatcontainer/microsoft.visualstudio.web.codegenerators.mvc/2.1.9/microsoft.visualstudio.web.codegenerators.mvc.2.1.9.nupkg 30ms
GET https://api.nuget.org/v3-flatcontainer/microsoft.visualstudio.web.codegeneration/index.json
OK https://api.nuget.org/v3-flatcontainer/microsoft.visualstudio.web.codegeneration/index.json 44ms
GET https://api.nuget.org/v3-flatcontainer/microsoft.visualstudio.web.codegeneration/2.1.9/microsoft.visualstudio.web.codegeneration.2.1.9.nupkg
OK https://api.nuget.org/v3-flatcontainer/microsoft.visualstudio.web.codegeneration/2.1.9/microsoft.visualstudio.web.codegeneration.2.1.9.nupkg 29ms
GET https://api.nuget.org/v3-flatcontainer/microsoft.visualstudio.web.codegeneration.entityframeworkcore/index.json
OK https://api.nuget.org/v3-flatcontainer/microsoft.visualstudio.web.codegeneration.entityframeworkcore/index.json 58ms
GET https://api.nuget.org/v3-flatcontainer/microsoft.visualstudio.web.codegeneration.entityframeworkcore/2.1.9/microsoft.visualstudio.web.codegeneration.entityframeworkcore.2.1.9.nupkg
OK https://api.nuget.org/v3-flatcontainer/microsoft.visualstudio.web.codegeneration.entityframeworkcore/2.1.9/microsoft.visualstudio.web.codegeneration.entityframeworkcore.2.1.9.nupkg 29ms
GET https://api.nuget.org/v3-flatcontainer/microsoft.visualstudio.web.codegeneration.core/index.json
OK https://api.nuget.org/v3-flatcontainer/microsoft.visualstudio.web.codegeneration.core/index.json 41ms
GET https://api.nuget.org/v3-flatcontainer/microsoft.visualstudio.web.codegeneration.core/2.1.9/microsoft.visualstudio.web.codegeneration.core.2.1.9.nupkg
OK https://api.nuget.org/v3-flatcontainer/microsoft.visualstudio.web.codegeneration.core/2.1.9/microsoft.visualstudio.web.codegeneration.core.2.1.9.nupkg 30ms
GET https://api.nuget.org/v3-flatcontainer/microsoft.visualstudio.web.codegeneration.templating/index.json
OK https://api.nuget.org/v3-flatcontainer/microsoft.visualstudio.web.codegeneration.templating/index.json 42ms
GET https://api.nuget.org/v3-flatcontainer/microsoft.visualstudio.web.codegeneration.templating/2.1.9/microsoft.visualstudio.web.codegeneration.templating.2.1.9.nupkg
OK https://api.nuget.org/v3-flatcontainer/microsoft.visualstudio.web.codegeneration.templating/2.1.9/microsoft.visualstudio.web.codegeneration.templating.2.1.9.nupkg 29ms
GET https://api.nuget.org/v3-flatcontainer/microsoft.visualstudio.web.codegeneration.utils/index.json
OK https://api.nuget.org/v3-flatcontainer/microsoft.visualstudio.web.codegeneration.utils/index.json 60ms
GET https://api.nuget.org/v3-flatcontainer/microsoft.visualstudio.web.codegeneration.utils/2.1.9/microsoft.visualstudio.web.codegeneration.utils.2.1.9.nupkg
OK https://api.nuget.org/v3-flatcontainer/microsoft.visualstudio.web.codegeneration.utils/2.1.9/microsoft.visualstudio.web.codegeneration.utils.2.1.9.nupkg 30ms
GET https://api.nuget.org/v3-flatcontainer/microsoft.visualstudio.web.codegeneration.contracts/index.json
OK https://api.nuget.org/v3-flatcontainer/microsoft.visualstudio.web.codegeneration.contracts/index.json 61ms
GET https://api.nuget.org/v3-flatcontainer/microsoft.visualstudio.web.codegeneration.contracts/2.1.9/microsoft.visualstudio.web.codegeneration.contracts.2.1.9.nupkg
OK https://api.nuget.org/v3-flatcontainer/microsoft.visualstudio.web.codegeneration.contracts/2.1.9/microsoft.visualstudio.web.codegeneration.contracts.2.1.9.nupkg 32ms
Installing Microsoft.VisualStudio.Web.CodeGeneration.Contracts 2.1.9.
Installing Microsoft.VisualStudio.Web.CodeGeneration.Utils 2.1.9.
Installing Microsoft.VisualStudio.Web.CodeGeneration.Templating 2.1.9.
Installing Microsoft.VisualStudio.Web.CodeGeneration.Core 2.1.9.
Installing Microsoft.VisualStudio.Web.CodeGeneration.EntityFrameworkCore 2.1.9.
Installing Microsoft.VisualStudio.Web.CodeGeneration 2.1.9.
Installing Microsoft.VisualStudio.Web.CodeGenerators.Mvc 2.1.9.
Installing Microsoft.VisualStudio.Web.CodeGeneration.Design 2.1.9.
Committing restore...
Generating MSBuild file C:\Program Files (x86)\Jenkins\workspace\Windows Service Deployment\AspCore\obj\AspCore.csproj.nuget.g.props.
Generating MSBuild file C:\Program Files (x86)\Jenkins\workspace\Windows Service Deployment\AspCore\obj\AspCore.csproj.nuget.g.targets.
Writing assets file to disk. Path: C:\Program Files (x86)\Jenkins\workspace\Windows Service Deployment\AspCore\obj\project.assets.json
Restore completed in 3.73 sec for C:\Program Files (x86)\Jenkins\workspace\Windows Service Deployment\AspCore\AspCore.csproj.
NuGet Config files used:
C:\Windows\system32\config\systemprofile\AppData\Roaming\NuGet\NuGet.Config
C:\Program Files (x86)\NuGet\Config\Microsoft.VisualStudio.Offline.config
Feeds used:
C:\Program Files (x86)\Microsoft SDKs\NuGetPackages\
https://api.nuget.org/v3/index.json
Installed:
8 package(s) to C:\Program Files (x86)\Jenkins\workspace\Windows Service Deployment\AspCore\AspCore.csproj
C:\Program Files (x86)\Jenkins\workspace\Windows Service Deployment>exit 0
Path To MSBuild.exe: C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\15.0\Bin\msbuild.exe
Executing the command cmd.exe /C " chcp 1252 & "C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\15.0\Bin\msbuild.exe" AspCore.sln " && exit %%ERRORLEVEL%% from C:\Program Files (x86)\Jenkins\workspace\Windows Service Deployment
[Windows Service Deployment] $ cmd.exe /C " chcp 1252 & "C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\15.0\Bin\msbuild.exe" AspCore.sln " && exit %%ERRORLEVEL%%
Active code page: 1252
Microsoft (R) Build Engine version 15.9.21+g9802d43bc3 for .NET Framework
Copyright (C) Microsoft Corporation. All rights reserved.
Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch.
Build started 10/27/2019 4:54:18 PM.
Project "C:\Program Files (x86)\Jenkins\workspace\Windows Service Deployment\AspCore.sln" on node 1 (default targets).
ValidateSolutionConfiguration:
Building solution configuration "Debug|Any CPU".
Project "C:\Program Files (x86)\Jenkins\workspace\Windows Service Deployment\AspCore.sln" (1) is building "C:\Program Files (x86)\Jenkins\workspace\Windows Service Deployment\AspCore\AspCore.csproj" (2) on node 1 (default targets).
C:\Program Files\dotnet\sdk\2.1.509\Sdks\Microsoft.NET.Sdk\targets\Microsoft.PackageDependencyResolution.targets(198,5): error NETSDK1064: Package Microsoft.VisualStudio.Web.CodeGeneration, version 2.1.9 was not found. It might have been deleted since NuGet restore. Otherwise, NuGet restore might have only partially completed, which might have been due to maximum path length restrictions. [C:\Program Files (x86)\Jenkins\workspace\Windows Service Deployment\AspCore\AspCore.csproj]
Done Building Project "C:\Program Files (x86)\Jenkins\workspace\Windows Service Deployment\AspCore\AspCore.csproj" (default targets) -- FAILED.
Done Building Project "C:\Program Files (x86)\Jenkins\workspace\Windows Service Deployment\AspCore.sln" (default targets) -- FAILED.
Build FAILED.
"C:\Program Files (x86)\Jenkins\workspace\Windows Service Deployment\AspCore.sln" (default target) (1) ->
"C:\Program Files (x86)\Jenkins\workspace\Windows Service Deployment\AspCore\AspCore.csproj" (default target) (2) ->
(ResolvePackageAssets target) ->
C:\Program Files\dotnet\sdk\2.1.509\Sdks\Microsoft.NET.Sdk\targets\Microsoft.PackageDependencyResolution.targets(198,5): error NETSDK1064: Package Microsoft.VisualStudio.Web.CodeGeneration, version 2.1.9 was not found. It might have been deleted since NuGet restore. Otherwise, NuGet restore might have only partially completed, which might have been due to maximum path length restrictions. [C:\Program Files (x86)\Jenkins\workspace\Windows Service Deployment\AspCore\AspCore.csproj]
0 Warning(s)
1 Error(s)
Time Elapsed 00:00:00.44
Build step 'Build a Visual Studio project or solution using MSBuild' marked build as failure
Finished: FAILURE
Please take a look at this solution, it worked for me:
'dotnet build' command not finding NuGet packages (they exist)
so you just need to call this build command defining the nuget path in the jenkinsfile:
sh 'dotnet build --packages ./.nuget/packages'

Force Bazel to use local java only

I'd like to use bazel in a locked-down environment, one without uncontrolled internet access. I'd like to force bazel to use the locally installed java, instead of downloading one. I could not figure out the required combination of flags - this is what I tried:
$ java -version
java version "1.8.0_171"
Java(TM) SE Runtime Environment (build 1.8.0_171-b11)
Java HotSpot(TM) 64-Bit Server VM (build 25.171-b11, mixed mode)
$ javac -version
javac 1.8.0_171
$ bazel clean --expunge
$ bazel info release
release 0.24.1
$ bazel build //hello
# This builds a 'hello world' cpp file.
# This rule also downloads some rules, would be nice to avoid it as
INFO: Build completed successfully, 6 total actions well
$ bazel test --nofetch //hello:hello_test
ERROR: /home/erenon/.cache/bazel/_bazel_erenon/afacf41c7e3fc3f4ea7510d344b4de38/external/bazel_tools/tools/jdk/BUILD:218:1: no such package '#remote_java_tools//': to fix, run
bazel fetch //...
External repository #remote_java_tools not found and fetching repositories is disabled. and referenced by '#bazel_tools//tools/jdk:JacocoCoverageRunner'
ERROR: Analysis of target '//hello:hello_test' failed; build aborted: no such package '#remote_java_tools//': to fix, run
bazel fetch //...
External repository #remote_java_tools not found and fetching repositories is disabled.
INFO: Elapsed time: 0.160s
INFO: 0 processes.
FAILED: Build did NOT complete successfully (3 packages loaded, 27 targets configured)
FAILED: Build did NOT complete successfully (3 packages loaded, 27 targets configured)
I get the same results with a more intricate command line:
$ bazel test --nofetch --define=ABSOLUTE_JAVABASE=/usr/lib/jvm/java-8-openjdk-amd64 --host_javabase=#local_jdk//:jdk --javabase=#local_jdk//:jdk --host_java_toolchain=#bazel_tools//tools/jdk:toolchain_hostjdk8 --java_toolchain=#bazel_tools//tools/jdk:toolchain_hostjdk8 //hello:hello_test
INFO: Build options --define, --host_java_toolchain, --host_javabase, and 2 more have changed, discarding analysis cache.
ERROR: /home/erenon/.cache/bazel/_bazel_erenon/afacf41c7e3fc3f4ea7510d344b4de38/external/bazel_tools/tools/jdk/BUILD:218:1: no such package '#remote_java_tools//': to fix, run
bazel fetch //...
External repository #remote_java_tools not found and fetching repositories is disabled. and referenced by '#bazel_tools//tools/jdk:JacocoCoverageRunner'
ERROR: Analysis of target '//hello:hello_test' failed; build aborted: no such package '#remote_java_tools//': to fix, run
bazel fetch //...
External repository #remote_java_tools not found and fetching repositories is disabled.
INFO: Elapsed time: 0.215s
INFO: 0 processes.
FAILED: Build did NOT complete successfully (0 packages loaded, 50 targets configured)
FAILED: Build did NOT complete successfully (0 packages loaded, 50 targets configured)
I tried every combination of the java flags, no luck. I also tried to enable every incompatible change (--all_incompatible_changes), which yields to a different result:
INFO: Build options --incompatible_allow_python_version_transitions, --incompatible_auto_configure_host_platform, --incompatible_cc_coverage, and 24 more have changed, discarding analysis cache.
ERROR: While resolving toolchains for target //hello:hello_test: com.google.devtools.build.lib.packages.BuildFileNotFoundException: no such package '#local_config_platform//': to fix, run
bazel fetch //...
External repository #local_config_platform not found and fetching repositories is disabled.
ERROR: Analysis of target '//hello:hello_test' failed; build aborted: com.google.devtools.build.lib.packages.BuildFileNotFoundException: no such package '#local_config_platform//': to fix, run
bazel fetch //...
External repository #local_config_platform not found and fetching repositories is disabled.
INFO: Elapsed time: 0.228s
INFO: 0 processes.
FAILED: Build did NOT complete successfully (1 packages loaded, 0 targets configured)
FAILED: Build did NOT complete successfully (1 packages loaded, 0 targets configured)
It now looks for #local_config_platform.
Is there a bazel target which I can build from source and includes these dependencies?
Is there a different command line, which enables bazel test --nofetch?
It appear that bootstrapping bazel from source can solve the issue. After downloading bazel-<version>-dist.zip from GitHub, in the unzipped folder:
env EXTRA_BAZEL_ARGS="--host_javabase=#local_jdk//:jdk" bash ./compile.sh
The compiled output is placed into output/bazel. This is a self-contained Bazel binary, without an embedded JDK.
https://docs.bazel.build/versions/master/install-compile-source.html

References to NuGet packages cannot be resolved in F# project being built in VSTS

With Visual Studio 2017 Community I have created a solution with a F# library project (regular, not PCL) targeting the .NET 4.5.2 framework and the F# 4.1 (FSharp.Core, 4.4.1.0) runtime. Visual Studio added for me the NuGet reference to System.ValueType (4.3.0) by default.
The only code in this project is the following which is using System.ValueType:
type TupleCreator() =
member this.Create x =
System.ValueTuple.Create(x)
Building the project locally works fine, unfortunately this is not the case with VSTS. I have a build definition (with default agent queue set to Hosted VS2017) with a NuGet restore step and a build solution step (with Visual Studio Version set to Latest).
When the build runs it succeeds in restoring the nuget packages:
##[section]Starting: NuGet restore **\*.sln
=================================================================
Task : NuGet Installer
Description : Installs or restores missing NuGet packages
Version : 0.2.31
Author : Microsoft Corporation
=================================================================
[command]C:\Windows\system32\chcp.com 65001
Active code page: 65001
Detected NuGet version 3.3.0.212 / 3.3.0
SYSTEMVSSCONNECTION exists true
To connect to NuGet feeds hosted in your Team Services account/TFS project collection on this build agent, edit your build definition to choose a higher version of nuget or specify a path to a NuGet.config containing the package sources you wish to use.
[command]d:\a\_tasks\NuGetInstaller_333b11bd-d341-40d9-afcf-b32d5ce6f23b\0.2.31\node_modules\nuget-task-common\NuGet\3.3.0\NuGet.exe restore -NonInteractive d:\a\3\s\Apps\Sandbox\FSharpWithNugetDemo\FSharpWithNugetDemo.sln
MSBuild auto-detection: using msbuild version '4.0' from 'C:\Windows\Microsoft.NET\Framework\v4.0.30319'.
Feeds used:
C:\Users\buildguest\AppData\Local\NuGet\Cache
https://api.nuget.org/v3/index.json
Restoring NuGet package System.ValueTuple.4.3.0.
Adding package 'System.ValueTuple.4.3.0' to folder 'd:\a\3\s\Apps\Sandbox\FSharpWithNugetDemo\packages'
Added package 'System.ValueTuple.4.3.0' to folder 'd:\a\3\s\Apps\Sandbox\FSharpWithNugetDemo\packages'
##[section]Finishing: NuGet restore **\*.sln
The build step then yields the following log:
##[section]Starting: Build solution $/tfs1/Apps/Sandbox/FSharpWithNugetDemo/FSharpWithNugetDemo.sln
==============================================================================
Task : Visual Studio Build
Description : Build with MSBuild and set the Visual Studio version property
Version : 1.117.0
Author : Microsoft Corporation
Help : [More Information](https://go.microsoft.com/fwlink/?LinkID=613727)
==============================================================================
##[command]"D:\a\_tasks\VSBuild_71a9a2d3-a98a-4caa-96ab-affca411ecda\1.117.0\ps_modules\MSBuildHelpers\vswhere.exe" -version [15.0,15.1) -latest -format json
##[command]"C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\msbuild.exe" "d:\a\3\s\Apps\Sandbox\FSharpWithNugetDemo\FSharpWithNugetDemo.sln" /nologo /nr:false /dl:CentralLogger,"D:\a\_tasks\VSBuild_71a9a2d3-a98a-4caa-96ab-affca411ecda\1.117.0\ps_modules\MSBuildHelpers\Microsoft.TeamFoundation.DistributedTask.MSBuild.Logger.dll";"RootDetailId=d08ecee6-b628-4743-9e80-d31a64026956|SolutionDir=d:\a\3\s\Apps\Sandbox\FSharpWithNugetDemo"*ForwardingLogger,"D:\a\_tasks\VSBuild_71a9a2d3-a98a-4caa-96ab-affca411ecda\1.117.0\ps_modules\MSBuildHelpers\Microsoft.TeamFoundation.DistributedTask.MSBuild.Logger.dll" /p:TreatWarningsAsErrors=False /p:platform="any cpu" /p:configuration="debug" /p:VisualStudioVersion="15.0" /p:_MSDeployUserAgent="VSTS_1e91f890-819e-4329-aa62-069b62ae16d0_build_4_116"
Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch.
Build started 5/24/2017 6:32:52 PM.
Project "d:\a\3\s\Apps\Sandbox\FSharpWithNugetDemo\FSharpWithNugetDemo.sln" on node 1 (default targets).
ValidateSolutionConfiguration:
Building solution configuration "debug|any cpu".
Project "d:\a\3\s\Apps\Sandbox\FSharpWithNugetDemo\FSharpWithNugetDemo.sln" (1) is building "d:\a\3\s\Apps\Sandbox\FSharpWithNugetDemo\FSharpWithNugetDemo.fsproj" (2) on node 1 (default targets).
PrepareForBuild:
Creating directory "bin\Debug\".
Creating directory "obj\Debug\".
ResolveAssemblyReferences:
Primary reference "System.ValueTuple".
##[warning]C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\Microsoft.Common.CurrentVersion.targets(1964,5): Warning MSB3245: Could not resolve this reference. Could not locate the assembly "System.ValueTuple". Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors.
C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\Microsoft.Common.CurrentVersion.targets(1964,5): warning MSB3245: Could not resolve this reference. Could not locate the assembly "System.ValueTuple". Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors. [d:\a\3\s\Apps\Sandbox\FSharpWithNugetDemo\FSharpWithNugetDemo.fsproj]
For SearchPath "{HintPathFromItem}".
Considered "..\..\Sandbox (local)\packages\System.ValueTuple.4.3.0\lib\netstandard1.0\System.ValueTuple.dll", but it didn't exist.
For SearchPath "{TargetFrameworkDirectory}".
Considered "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5.2\System.ValueTuple.winmd", but it didn't exist.
Considered "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5.2\System.ValueTuple.dll", but it didn't exist.
Considered "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5.2\System.ValueTuple.exe", but it didn't exist.
.
.
.
Considered "bin\Debug\System.ValueTuple.exe", but it didn't exist.
CoreCompile:
C:\Program Files (x86)\Microsoft SDKs\F#\4.1\Framework\v4.0\fsc.exe -o:obj\Debug\FSharpWithNugetDemo.dll
-g
--debug:full
--noframework
--define:DEBUG
--define:TRACE
--doc:bin\Debug\FSharpWithNugetDemo.XML
--optimize-
--tailcalls-
-r:C:\Program Files (x86)\Reference Assemblies\Microsoft\FSharp\.NETFramework\v4.0\4.4.1.0\FSharp.Core.dll
-r:C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5.2\mscorlib.dll
-r:C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5.2\System.Core.dll
-r:C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5.2\System.dll
-r:C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5.2\System.Numerics.dll
--target:library
--warn:3
--warnaserror:76
--fullpaths
--flaterrors
--subsystemversion:6.00
--highentropyva+
d:\a\_temp\.NETFramework,Version=v4.5.2.AssemblyAttributes.fs
AssemblyInfo.fs
Library1.fs
##[error]Apps\Sandbox\FSharpWithNugetDemo\Library1.fs(5,12): Error FS0039: The value, constructor, namespace or type 'ValueTuple' is not defined. Maybe you want one of the following: ValueType
d:\a\3\s\Apps\Sandbox\FSharpWithNugetDemo\Library1.fs(5,12): error FS0039: The value, constructor, namespace or type 'ValueTuple' is not defined. Maybe you want one of the following: ValueType [d:\a\3\s\Apps\Sandbox\FSharpWithNugetDemo\FSharpWithNugetDemo.fsproj]
Done Building Project "d:\a\3\s\Apps\Sandbox\FSharpWithNugetDemo\FSharpWithNugetDemo.fsproj" (default targets) -- FAILED.
Done Building Project "d:\a\3\s\Apps\Sandbox\FSharpWithNugetDemo\FSharpWithNugetDemo.sln" (default targets) -- FAILED.
Build FAILED.
"d:\a\3\s\Apps\Sandbox\FSharpWithNugetDemo\FSharpWithNugetDemo.sln" (default target) (1) ->
"d:\a\3\s\Apps\Sandbox\FSharpWithNugetDemo\FSharpWithNugetDemo.fsproj" (default target) (2) ->
(ResolveAssemblyReferences target) ->
C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\Microsoft.Common.CurrentVersion.targets(1964,5): warning MSB3245: Could not resolve this reference. Could not locate the assembly "System.ValueTuple". Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors. [d:\a\3\s\Apps\Sandbox\FSharpWithNugetDemo\FSharpWithNugetDemo.fsproj]
"d:\a\3\s\Apps\Sandbox\FSharpWithNugetDemo\FSharpWithNugetDemo.sln" (default target) (1) ->
"d:\a\3\s\Apps\Sandbox\FSharpWithNugetDemo\FSharpWithNugetDemo.fsproj" (default target) (2) ->
(CoreCompile target) ->
d:\a\3\s\Apps\Sandbox\FSharpWithNugetDemo\Library1.fs(5,12): error FS0039: The value, constructor, namespace or type 'ValueTuple' is not defined. Maybe you want one of the following: ValueType [d:\a\3\s\Apps\Sandbox\FSharpWithNugetDemo\FSharpWithNugetDemo.fsproj]
1 Warning(s)
1 Error(s)
Time Elapsed 00:00:06.14
##[error]Process 'msbuild.exe' exited with code '1'.
This is not an issue with System.ValueType because the build process is unable to build with references to any nuget packages. This is also not an issue with my VSTS because my C# projects with NuGet references get built fine.
What is wrong with my F# project? Are there additional steps to be taken in order to enable NuGet in F# projects on VSTS?
EDIT
I just compared the output of the CoreCompile section with what is printed in Visual Studio. In Visual Studio it says:
C:\Program Files (x86)\Microsoft SDKs\F#\4.1\Framework\v4.0\fsc.exe -o:obj\Debug\FSharpWithNugetDemo.dll
-g
--debug:full
--noframework
--define:DEBUG
--define:TRACE
--doc:bin\Debug\FSharpWithNugetDemo.XML
--optimize-
--tailcalls-
-r:C:\Program Files (x86)\Reference Assemblies\Microsoft\FSharp\.NETFramework\v4.0\4.4.1.0\FSharp.Core.dll
-r:C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5.2\mscorlib.dll
-r:C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5.2\System.Core.dll
-r:C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5.2\System.dll
-r:C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5.2\System.Numerics.dll
-r:D:\Projects\Sandbox\packages\System.ValueTuple.4.3.0\lib\netstandard1.0\System.ValueTuple.dll
.
.
.
--target:library
--warn:3
--warnaserror:76
--vserrors
--utf8output
--fullpaths
--flaterrors
--subsystemversion:6.00
--highentropyva+
C:\Users\David\AppData\Local\Temp\.NETFramework,Version=v4.5.2.AssemblyAttributes.fs
AssemblyInfo.fs
Library1.fs
FSharpWithNugetDemo -> D:\Projekte\VisualStudio.com\sphereutfs\Dev\Apps\Sandbox\FSharpWithNugetDemo\bin\Debug\FSharpWithNugetDemo.dll
The difference is that there is a -r: line with a path to the System.ValueTuple.dll obtained from NuGet which is missing in the log of the VSTS build. How can I tell the VSTS build to include this reference when compiling?
This is caused the setting in your FSharpWithNugetDemo.fsproj file. You set the path for System.ValueTuple as your local path:
<Reference Include="System.ValueTuple">
<HintPath>..\..\Sandbox (local)\packages\System.ValueTuple.4.3.0\lib\netstandard1.0\System.ValueTuple.dll</HintPath>
</Reference>
It should be use relate path so that when it build by VSTS, System.ValueTuple will be searched in $(build.sourcesdirectory):
<Reference Include="System.ValueTuple">
<HintPath>..\packages\System.ValueTuple.4.3.0\lib\netstandard1.0\System.ValueTuple.dll</HintPath>
</Reference>

NuGet Package missing error when trying to use TFS Servcice

I'm hoping someone can help diagnose whats going wrong with my build. I'm using Visual Studio 2012, NuGet 2.7, & TFS Service (git). I've been unable to get around the following error:
"C:\a\src\src\RecipeDb.Mvc\RecipeDb.Mvc.csproj (361): 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=317567."
I've enabled the package restore feature (but it think i've heard with nuget 2.7 it doesn't matter). Anyways i found a helpful blog about this problem at :
Blog Article
Here is my current build script:
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0"
DefaultTargets="Build"
xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<OutDir>$(MSBuildThisFileDirectory)bin</OutDir>
<Configuration>Release</Configuration>
<ProjectProperties>
OutDir=$(OutDir);
Configuration=$(Configuration);
</ProjectProperties>
</PropertyGroup>
<ItemGroup>
<Solution Include="$(MSBuildThisFileDirectory)src\*.sln" />
</ItemGroup>
<Target Name="RestorePackages">
<Exec Command=""$(MSBuildThisFileDirectory)src\.nuget\NuGet.exe" restore "%(Solution.Identity)"" />
</Target>
<Target Name="Clean">
<MSBuild Targets="Clean"
Projects="#(Solution)"
Properties="$(ProjectProperties)" />
</Target>
<Target Name="Build" DependsOnTargets="RestorePackages">
<MSBuild Targets="Build"
Projects="#(Solution)"
Properties="$(ProjectProperties)" />
</Target>
<Target Name="Rebuild" DependsOnTargets="RestorePackages">
<MSBuild Targets="Rebuild"
Projects="#(Solution)"
Properties="$(ProjectProperties)" />
</Target>
</Project>
and here is my build log:
Build started 9/27/2013 1:01:14 AM.
Project "C:\a\src\build.proj" on node 1 (default targets).
RestorePackages:
"C:\a\src\src\.nuget\NuGet.exe" restore "C:\a\src\src\RecipeDb.sln"
Project "C:\a\src\build.proj" (1) is building "C:\a\src\src\RecipeDb.sln" (2) on node 1 (Build target(s)).
ValidateSolutionConfiguration:
Building solution configuration "Release|Any CPU".
Project "C:\a\src\src\RecipeDb.sln" (2) is building "C:\a\src\src\RecipeDb.Mvc\RecipeDb.Mvc.csproj" (3) on node 1 (default targets).
C:\a\src\src\RecipeDb.Mvc\RecipeDb.Mvc.csproj(361,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=317567.
Done Building Project "C:\a\src\src\RecipeDb.Mvc\RecipeDb.Mvc.csproj" (default targets) -- FAILED.
Project "C:\a\src\src\RecipeDb.sln" (2) is building "C:\a\src\src\RecipeDb.Mvc.Tests\RecipeDb.Mvc.Tests.csproj" (5) on node 1 (default targets).
C:\a\src\src\RecipeDb.Mvc.Tests\RecipeDb.Mvc.Tests.csproj(144,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=317567.
Done Building Project "C:\a\src\src\RecipeDb.Mvc.Tests\RecipeDb.Mvc.Tests.csproj" (default targets) -- FAILED.
Done Building Project "C:\a\src\src\RecipeDb.sln" (Build target(s)) -- FAILED.
Done Building Project "C:\a\src\build.proj" (default targets) -- FAILED.
Build FAILED.
"C:\a\src\build.proj" (default target) (1) ->
"C:\a\src\src\RecipeDb.sln" (Build target) (2) ->
"C:\a\src\src\RecipeDb.Mvc\RecipeDb.Mvc.csproj" (default target) (3) ->
(EnsureBclBuildImported target) ->
C:\a\src\src\RecipeDb.M
vc\RecipeDb.Mvc.csproj(361,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=317567.
"C:\a\src\build.proj" (default target) (1) ->
"C:\a\src\src\RecipeDb.sln" (Build target) (2) ->
"C:\a\src\src\RecipeDb.Mvc.Tests\RecipeDb.Mvc.Tests.csproj" (default target) (5) ->
C:\a\src\src\RecipeDb.Mvc.Tests\RecipeDb.Mvc.Tests.csproj(144,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=317567.
0 Warning(s)
2 Error(s)
Time Elapsed 00:00:09.21
So i copied his build log and just changed the path where nuget.exe is. Nuget.exe command seems to be running but apparently its not downloading the packages. Of course building locally works fine (even if i delete the packages directory.
As I can see in the link in the error message line you posted:
There is an improvement in Nuget 2.7 as below:
The Improvement
We’ve updated Microsoft.Bcl.Build to use a different approach. The
new version will use a conditional import similar to what NuGet’s
automatic import feature does. This will always allow the project to
load in Visual Studio.
However, Microsoft.Bcl.Build also adds a target to your project
that will run after the build is finished. This target checks whether
the current build restored packages and if so fail the build with an
actionable error message:
The build restored NuGet packages. Build the project again to include
these packages in the build. For more information, see
http://go.microsoft.com/fwlink/?LinkID=317568.
Building a second time will fix this error. Please note that this
error will only appear if packages were missing so it’s not like you
always have to build twice.
However, below that it says that it will not address build server/continuous integration (CI) scenarios and it needs a solution as specified in the following excerpt from the article:
This solution doesn’t address build server / continuous integration
(CI) scenarios. In order to successfully use package restore on the
build server, you have two options:
Check-in the .targets file.
Explicitly run NuGet package restore prior to building your project/solution.
Hope the issue you are facing is also because of this only.
For me the reference to Microsoft.Bcl.Build and the BeforeTargets="BeforeBuild" was causing problems. This got added when Microsoft.Bcl.Build was added as a dependency to an Azure Nuget package.
Try checking your project file and removing it.
<Import Project="..\packages\Microsoft.Bcl.Build.1.0.14\tools\Microsoft.Bcl.Build.targets" Condition="Exists('..\packages\Microsoft.Bcl.Build.1.0.14\tools\Microsoft.Bcl.Build.targets')" />
<Target Name="EnsureBclBuildImported" BeforeTargets="BeforeBuild" Condition="'$(BclBuildImported)' == ''">
<Error Condition="!Exists('..\packages\Microsoft.Bcl.Build.1.0.14\tools\Microsoft.Bcl.Build.targets')" Text="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=317567." HelpKeyword="BCLBUILD2001" />
<Error Condition="Exists('..\packages\Microsoft.Bcl.Build.1.0.14\tools\Microsoft.Bcl.Build.targets')" Text="The build restored NuGet packages. Build the project again to include these packages in the build. For more information, see http://go.microsoft.com/fwlink/?LinkID=317568." HelpKeyword="BCLBUILD2002" />
</Target>

Resources