VSTS Xamarin.Android build error - xamarin.android

I want to setup the build of my Xamarin.Android app in VSTS.
I received the following error in the Build.Xamarin.Android step: Error : This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is ....\packages\Xamarin.Android.Support.Animated.Vector.Drawable.25.4.0.2\build\MonoAndroid70\Xamarin.Android.Support.Animated.Vector.Drawable.targets
I followed the steps as described on the page described in this link: https://learn.microsoft.com/nl-nl/vsts/build-release/apps/mobile/xamarin?tabs=vsts
What am I doing wrong?

Build.Xamarin.Android step: Error : This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105.
You need to check two tasks in your build definition:
Task : Use NuGet 4.3.0
Task : NuGet restore
If any task is missing in your build definition, please add it. If the error persists, please provide the build log.

Related

Jenkins - Run a NuGet package restore to generate this file

When I build .NET Standard 2.0 Library on Jenkins build server
C:\Program Files\dotnet\sdk\2.1.302\Sdks\Microsoft.NET.Sdk\targets\Microsoft.PackageDependencyResolution.targets(198,5): error : Assets file 'C:\Jenkins\workspace\<Project>\Sources\Library\obj\project.assets.json' not found. Run a NuGet package restore to generate this file. [C:\Jenkins\workspace\<Project>\Sources\Library\Library.csproj]
I got an error above in build log.
I searched about error and I found solution
However, when running:
dotnet restore <Solution Name>
the solution does not help me out when I clean my workspace before build starts.
Therefore, I insert command before MSBuild but I failed with
C:\Program Files\dotnet\sdk\2.1.302\Sdks\Microsoft.NET.Sdk\targets\Microsoft.PackageDependencyResolution.targets(198,5): error : Package Microsoft.CodeAnalysis.CSharp.Workspaces, version 2.8.0 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:\Jenkins\workspace\<Project>\Sources\Web\Web.csproj]
According to Solution reference, maybe upgrade Nuget Package Installer could help me out. But I do not know how can I upgrade Nuget Package Installer by command line...
I had the same problem, getting the same error:
error : Package <package> 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. [<path>]
I was able to solve it using MSBuild /t:restore instead of dotnet restore.
See: https://learn.microsoft.com/en-us/nuget/reference/msbuild-targets#restore-target
UPDATE: It's worth mentioning that problems in Jenkins are discussed in depth in this other answer.
The hint by #Mat didn't work for me: the /t:restore is currently not able to restore nuget packages for projects using package.config, as I mention here. What worked for me is the following:
call "%PROGRAMFILES(X86)%\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvars64.bat"
nuget restore CodeBinder.sln
MSBuild Solution.sln /p:Configuration=Release /p:Platform="Any CPU" /t:build /restore
pause
It basically requires to download the nuget CLI from official site[1], Windows x86 Commandline section. The switch /restore , as pointed here, fixed the partially completed Nuget restore error, similarly to MSBuild /t:restore, but it can be done in conjunction with /t:build.
[1] https://www.nuget.org/downloads

Nuget Restore in MS Build Step

In my asp.net web application, i have solution with 5 projects and nuget.org. In TFS Build Definition,
1) While building the whole solution in Visual Studio Build Task
Nuget packages getting restored.
2) While trying to generate executable files for individual projects in MS Build Task
If I select Restore Nuget packages, It's not finding nuget packages and step getting failed with message - "Process 'NuGet.exe' exited with code '1'."
I have tried many references online and none worked. Any suggestions on how to solve this?
Do i need to make any changes in the nuget.config file to support restoring
packages to individual projects.
Do not directly select Restore Nuget pacakges in MS build task configuration. This option is deprecated. To restore NuGet packages, add a NuGet Installer step before the build.
(Important) This option is deprecated. Make sure to clear this
checkbox and instead use the NuGet Installer build step.
Source Link: MSBuild
Besides, you could also build single project not the entire solution in Visual Studio Build task. Just select the project (.*proj) files instead of .sln file.
Unless you are building a customized MSBuild project file, then we recommend you use the MSBuild step instead of the Visual Studio Build step.
You could also try to build single project using Visual Studio Build task, see if the issue is still exists.
Same problem, downgraded to 4.4.1. it helped

TFS2018 Nuget not restoring in referenced projects

I am using TFS2018 and I am building a solution which is using a reference to another project. This project is using a Nuget which is not located on the machine. I have two Nuget steps defined before the build step. Use Nuget and Nuget Restore. I would assume Nuget Restore will handle restoring Nugets in referenced projects?
I am getting the following error during the build step:
> 2017-12-11T18:13:34.4411552Z ##[debug]Processed: ##vso[task.logdetail
> id=b053619e-0646-45e5-8778-efc3bdd6c71a;parentid=567e2a52-8416-481f-9c9c-4bf1c4c56077;name=MYBLLProject.csproj;type=Build;starttime=2017-12-11T18:13:34.4384956Z;state=InProgress;]
> 2017-12-11T18:13:34.4527426Z
> ##[error]MYBLLFolder\MYBLLProject.csproj(79,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\w\11\s\MyProject\\.nuget\NuGet.targets.
> 2017-12-11T18:13:34.4528532Z ##[debug]Processed: ##vso[task.logissue
> type=Error;sourcepath=C:\a\w\11\s\MYBLLProject\MYBLLProject.csproj;linenumber=79;columnnumber=5;code=;]This
> project references NuGet package(s) that are missing on this computer.
> Enable NuGet Package Restore to download them.
Nuget Restore will only work if you are pointing to a valid resource location. In this case it appears you are pointing to a resource that it is expecting to be on the local machine. You will need to find a Nuget repo that has the Nuget package you are looking for, or put it out on your own Nuget repo.

Unable to build WiX 3.10 project in TFS 2015

I am using TFS 2015 trail version in windows server 2012.I created windows service project in visual studio community edition along with WiX Project to package the windows service. If i build the solution from visual studio, I am able to get the MSI. But if i use Visual studio build in TFS 2015,i get the following error.
"Unexpected exit code received from msbuild.exe: 1" and "Task VSBuild
failed. This caused the job to fail. Look at the logs for the task for
more details."
I refered the below links as reference :
http://wixtoolset.org/documentation/manual/v3/msbuild/wix_with_team_build.html-
http://wixtoolset.org/documentation/manual/v3/msbuild/daily_builds.html
1) I am unable to follow the first link steps as i got struck in step 2:
i am unable to find configuration folder in build definition.
I was reading that we do not have TFSBuild.proj straing from TFS version 2010.
"Right-click on the Build Definition and select View Configuration
Folder." "Check out and open the file named TFSBuild.proj."
2)I am unable to follow second link as well. I am getting below error:
"The imported project "C:\wix\3.8\Wix.targets" was not found. Confirm
that the path in the declaration is correct, and that the
file exists on disk."
since I am new to TFS Build 2015, any help or guidance will be appreciated.
Beginning with NuGet 2.7, the NuGet Visual Studio extension integrates into Visual Studio's build events and restores missing packages when a build begins. This feature is enabled by default. If you are using NuGet to install Wix packages, that's why you can get a successful build from visual studio.
If you want to use NuGet to install Wix packages, you can create one build.proj to restore these packages during build. Check: http://docs.nuget.org/consume/package-restore/team-build
If you don't use NuGet to install Wix packages, a traditional way you can refer to:http://edwinfrey.com/blog/2012/06/11/building-wix-msis-in-tfs-preview/

How to ensure TFS build server gets updated Nuget packages

I have an ASP.NET MVC website that was using the pre-release bits of Application Insights. I used the 'Manage Nuget Packages' option on the website to upgrade Application Insights to the latest version. Everything builds and runs successfully locally. All the App. Insights DLLs have been updated to v1.1.0. However when I try to run a gated build on TFS to check these changes in I keep getting the following error:
This project references NuGet package(s) that are missing on this
computer(here it's pointing to the build server). Enable NuGet Package
Restore to download them. For more information, see
http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is
....\packages\Microsoft.ApplicationInsights.Agent.Intercept.0.17.0\build\Microsoft.ApplicationInsights.Agent.Intercept.targets.
This only happens when the gated build runs on trying to check in. It results in the gated build failing which rejects my checking.
Is there anything that I can do here?
Looking at the error i believe , you have not enabled automatic package restore option.
please enable this option to resolve the error , while nuget restore works.
Steps to enable :
Click on Tools -> Nuget Package Manager -> Package Manager Settings -->general --> check the option Automatically restore package while building .
This feature will download all packages which are referred by your packages.config files before building the code to make sure code has all references included while building the code.

Resources