I am using TFS 2015. I want to restore nuget packages on build.
while defining my build definition, I find "NuGet restore" task with name NuGet restore.
But, I find that "NuGet Installer" task with name NuGet restore is used in solutions provided by other people while I was researching at the ways to restore nuget package. I cannot find "NuGet Installer". is it available only in VSTS and not in TFS 2015?
can anyone please tell me the difference?
By default the NuGet Installer task in TFS 2015 and NuGet Restore task in TFS 2017 and later version (including VSTS) have the same function to restore the packages for solutions. But the new NuGet Restore task in TFS 2017 and later version is more flexible and feature-rich, it also has different versions.
The name "NuGet Installer" is the display name of the NuGet Restore task, in TFS 2017 and later version inculding VSTS we can custom the Display name. And in TFS 2015 we can also edit the display name, but seems they shown in different ways.
Conclusion : Do not focus on the task or display name as we can custome it. Just focus on the functions. See Package: NuGet task for details.
Related
We have a .net solution with around 30 projects in it.
We have a dependency on another internal project ( not in the same solution ), for which we use TeamCity NuGet to get the latest packages.
Currently, We update all packages using nuget update-packages command with a specific version that we need and check-in our code and then TeamCity builds it.
(We commit packages too)
We are looking for a simpler solution where TeamCity can automatically update to the latest package and check-in into TFS.
I have tried using TeamCity NuGet installer but it didn't work, also, what I want is to get updates only for a specific package (not all the packages in projects).
I want to execute my NuGet update-packages command as a TeamCity build step so that it will update the packages and we don't have to do it manually every time we have a new update available.
i think best option is you can use ms build.
msbuild will allow you to publish or push the nuget package along with version to server or will do checkin to tfs which is change.
Thanks
DJM
We are hosting TFS 2017 Update 2 on-prem, and using on-prem build agents. The latest version of NuGet.exe is currently 4.3.0, but our build agents always default to using v4.0.0. How can I get our build agents to use the latest version of NuGet.exe?
We need to update because NuGet restore is failing when using v4.0.0, but works with v4.3.0, since we are dealing with new .Net Standard 2.0 packages. On our build server I was able to do NuGet.exe update -self to update the NuGet.exe found at C:\Builds\_work\_tool\NuGet\4.0.0\x64\nuget.exe from 4.0.0 to 4.3.0, but that C:\Builds\_work\_tool directory regularly gets deleted and recreated, so this isn't a persistent workaround.
How can I get our build agents to always use the latest version of NuGet.exe, or at least v4.3.0?
I know you're not supposed to answer with a link, but this post provides all the details you'll need, confirming that the task does indeed still use 4.0.0, how with VSTS and TFS 2018 you don't have to worry about this anymore (there's a new NuGet Installer task) and how to recreate that kind of task for VS 2017.2 (and earlier) via a PowerShell Script, Using the latest NuGet in your build
Based on Greg's linked answer, but a little bit simpler:
Add a step "NuGet Tool Installer" before the other NuGet steps, use ">=5.0.0" for the version and mark "Always download the latest matching version", this should - well - give you the latest stable version
Replace the existing "NuGet Installer" steps - this seems to be the default with "NuGet Restore" steps, just copying the settings. They seem to be totally compatible, allowing e. g. for package config or solution files to be referenced, including pattern matching
That is it. Replacing the "NuGet Installer" that requires you to specify a version with the "NuGet Restore" that just uses the NuGet.exe from the path as set in "NuGet Tool Installer" is easier. Also mind the confusing naming (NuGet Tool Installer/NuGet Installer - the two are rather different).
Having to tinker so much with the not so old TFS 2017 infrastructure is a shame.
I used NuGet to add CastleWindsor to a project. Eveything works ok.
When I check it into tfs, I get the following message.
Unable to find version '3.3.3' of package 'Castle.Core'.
Any idea how I can get the build server to get the new version of Castle.Core?
First just as Dave commented, please check if you have add the nuget install task in your build definition and before your build task.
Also make sure you are using the right version of Nuget. For example, if you already use V3.0 and the config file are still point to V2.0. You will get this error.
Moreover, double check if the packages can be restored successfully on you dev PC and build agent manually, you can also compare the nuget.config file on your TFS server and dev PCs to see if there is any difference between them. The nuget.config file locates at "%APPDATA%\NuGet\NuGet.Config".
TFS2012 does not restore the nuget packages automatically, you need to add a build step to call the nuget command to restore the nuget packages. Refer to this link for details: Package Restore with Team Foundation Build.
With TFS 2013 and later, packages are automatically restored by
default during build, provided that you're using a Team Build Template
for Team Foundation Server 2013 or later.
If you're using a previous version of build templates (such as in a
project that's been migrated from earlier versions of TFS), you'll
need to also migrate those build templates to TFS 2013. This
essentially means recreating the custom parts of the Build Templates
using the appropriate template for your source control (TFVC or Git).
For earlier version of TFS, you can simply include a build step to
invoke command-line restore as described earlier.
We are currently testing whether we can replace our current build server (TeamCity) with TFS 2015 Build.
Does anyone know of TFS 2015 has built-in Nuget Server like TeamCity.
Thx
Package Management (NuGet with npm and maven coming soon) is currently only available for VSTS. The on-premises support for Package Management will come in the next version of TFS.
Source - TFS Feature Timeline for 2016
VSTS and TFS now provide built-in support for Maven Package Management to compliment its support of NuGet and npm.
https://blogs.msdn.microsoft.com/visualstudioalm/2017/05/22/visual-studio-team-services-demonstrates-how-microsoft-loves-java/
I have set the option on my VS2013 solution "Enable Nuget Package Restore" and its not restoring nuget packages on a build server. Plenty of missing references errors to System.Web.Mvc and so on...
Everything is fine on hosted TFS - but I'm running into issues with a secondary CI server using TeamCity. I don't have visual studio installed on the build server by choice.
I'd like to know how do I enable package restore on the build server.
I don't want the packages in source control and I'd like to avoid hosting my own nuget feed for the System.Web.Mvc etc..
Cheers!
I came across similar issue some time back, was able to resolve this by updating RestorePackages condition value to True in Nuget.Targets file.