7

Running Cake Build script on my local machine works fine but when same script is run on TeamCity, the following error appears: Nuspec file does not exist in package.

enter image description here

Any idea what could have caused this error?

nasiroudin
  • 337
  • 3
  • 14
  • go to the packages folder on your hard drive and delete all its contents. After that restore packages – Senior Pomidor Mar 13 '18 at 07:48
  • @SeniorPomidor I tried this but I am still getting this error. When I build the project from the TeamCity/Works directory using the build.cake file, it build successfully. – nasiroudin Mar 13 '18 at 12:03
  • then just build from this directory. – Senior Pomidor Mar 13 '18 at 12:05
  • @SeniorPomidor I want TeamCity to trigger the build automatically rather than running it manually. – nasiroudin Mar 13 '18 at 12:06
  • I want to say just set the working directory as TeamCity/Works. and build – Senior Pomidor Mar 13 '18 at 12:08
  • 2
    I had a similar problem with TFS 2017. Build was always red with same message, but when I tried in a console, it worked. Turns out that the reason why it worked was my user: When I started the console with the same user the build uses, I got the same error. So I deleted everything in `/.nuget/packages/*`, after that the build worked again. – Desty Apr 13 '18 at 08:28

2 Answers2

14

I spent two days due to this error On dotnet build --configuration Release in TeamCity PowerShell, always got this error

error NU5000: Nuspec file does not exist in package

After deleting this folder, everything worked C:/Users/teamcity_user/.nuget

Daniil Sokolyuk
  • 484
  • 1
  • 6
  • 10
3

I add an additional step on top of my build steps which is a command line custom script

dotnet nuget locals --clear all

Build Step to clear nuget locals

zapoo
  • 1,548
  • 3
  • 17
  • 32