On my build server in my prebuild script I want to get all packages required for the solution.
Why? Because this happens:
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 ..\packages\Microsoft.Bcl.Build.1.0.21\build\Microsoft.Bcl.Build.targets.
According to Nuget documentation package restore should happen as part of the TFS 2013 build - but quite obviously it does not.
I tried to implement this as a prebuild action (custom script execution).
Whenever I try to run nuget on the build server this is what happens:
PS D:\ws\more\txs04\Data\Services\MyProject\.nuget> .\nuget.exe
An existing connection was forcibly closed by the remote host
Obviously a proxy issue. Unfortunately I didn't find any solution for this. I logged on as the build user and changed the proxy settings. I also tried environment variables - and the nuget configuration options. However since I cannot even invoke
nuget.exe config this is kind of not an option.
Edit: I can reproduce this behavior on my development machine (where nuget usually works).
runas /user:dev\tfsbuild powershell Next I try to execute
nuget.exe and the above mentioned error occurs. It does not occur if I login with the tfsbuild user however.
I was having a similar issue running the nuget restore command from a target in my build .proj file.
<Target Name="RestorePackages"> <Exec Command=""$(ToolsHome)NuGet\NuGet.exe" restore "$(SourceHome)SolutionFile.sln"" /> </Target>
I added two additional parameters which resolved the issue for me: -NonInteractive -RequireConsent
<Target Name="RestorePackages"> <Exec Command=""$(ToolsHome)NuGet\NuGet.exe" restore "$(SourceHome)SolutionFile.sln" -NonInteractive -RequireConsent " /> </Target>
Hope this helps anyone else that runs into this.