TFS Build missing Castle Windsor - tfs

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.

Related

TeamCity Nuget update private package only

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

TFS On-Prem Build Agent Using Old Version Of NuGet.exe

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.

Restoring NuGet packages from custom Nugetserver using TFS Build 2015

We have a large number of solutions in our source control, which all use NuGet packages from a custom source (http://nugetserver/nuget). All solutions restore and build successfully locally within Visual Studio.
Using the new TFS 2015, our build definition looks like this:
The NuGet Installer step is there for us to restore our packages from a custom resource:
There is however no NuGet.exe file in the custom NuGet server directory. As suggested here tried just setting the -source to "https://www.nuget.org/api/v2/". We receive the same error at build whichever source we use:
You're specifying a command line argument in the "Path to NuGet.exe" field. That field should be used if you want to use a different version of NuGet than the one that's baked into the build agent.
What you need to do to solve your problem is:
Add your custom NuGet server to the machine's NuGet.config
or
Add your custom NuGet server to the application's NuGet.config.
See the NuGet docs for more info.
You're specifying the command line in the wrong field. That field is to use different version of NuGet.exe. You need to put your command in the NuGet Arguments field.
Additionally you might want to also add the default NuGet Feed to the available sources like this:
-source "https://www.nuget.org/api/v2/;http://nugetserver/nuget"

How do I increment the build/version number automatically on TFS Team builds?

I just downloaded the Automatic Versions add-in for VS here (https://visualstudiogallery.msdn.microsoft.com/dd8c5682-58a4-4c13-a0b4-9eadaba919fe/view/Discussions) and it works great locally, but how do I get it to work with Team Builds? Is there something I should install on the build server?
Firstly, the Automatic Version addin is not called in TFS build even if it is installed on TFS build server machine. In other words, you can't use it to generate incremental assembly version during TFS build process.
Instead, you need to create one custom build process activity to update assembly version, then customize the TFS build process template to add the activity. Please check the following links for the details of the sample build activity and how to customize build process template to use it.
http://www.codeproject.com/Articles/705482/Updating-Assembly-Versions-During-TFS-Builds
http://tfssimpleversioning.codeplex.com/
http://blogs.msdn.com/b/jjameson/archive/2010/11/29/incrementing-the-assembly-version-for-each-build-in-tfs-2010.aspx

Requirements for TFS Nuget Package Restore

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.

Resources