Issues with teamcity and dotnet nuget packages not found

Hi!

We have had an issue with TeamCity and a .NET 6 project for a while. When we build the project from the command line using this command:

dotnet build --configuration Release


It all works fine, but when the project is build by TeamCity the command looks like this:

"C:\Program Files\dotnet\dotnet.exe" publish C:\BuildAgent2\work\f7058813c1f95bba\MyProject.Web.UI\MyProject.Web.UI.csproj --configuration Release

This time we're getting a lot of strange issues around nuget packages not being found (see some examples below).


We have installed the latest .NET 6 SKD (6.0.401) and this errors just "pops" up some times without any changes to csproj-file or packages referenced. It's really strange.

Any one seen something similar?

 

C:\Program Files\dotnet\sdk\6.0.203\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NE
T.Publish.targets(248,5): error MSB3030: Could not copy the file "C:\Users\Admi
nistrator\.nuget\packages\system.appcontext\4.3.0\lib\netstandard1.6\System.App
Context.dll" because it was not found. [C:\BuildAgent2\work\f7058813c1f95bba\ER
ASweden.Web.UI\MyProject.Web.UI.csproj]

C:\Program Files\dotnet\sdk\6.0.203\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NE
T.Publish.targets(248,5): error MSB3030: Could not copy the file "C:\Users\Admi
nistrator\.nuget\packages\system.collections.concurrent\4.3.0\lib\netstandard1.
3\System.Collections.Concurrent.dll" because it was not found. [C:\BuildAgent2\
work\f7058813c1f95bba\MyProject.Web.UI\MyProject.Web.UI.csproj]

C:\Program Files\dotnet\sdk\6.0.203\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NE
T.Publish.targets(248,5): error MSB3030: Could not copy the file "C:\Users\Admi
nistrator\.nuget\packages\system.componentmodel\4.3.0\lib\netstandard1.3\System
.ComponentModel.dll" because it was not found. [C:\BuildAgent2\work\f7058813c1f
95bba\MyProject.Web.UI\MyProject.Web.UI.csproj]

C:\Program Files\dotnet\sdk\6.0.203\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NE
T.Publish.targets(248,5): error MSB3030: Could not copy the file "C:\Users\Admi
nistrator\.nuget\packages\system.diagnostics.stacktrace\4.3.0\lib\netstandard1.
3\System.Diagnostics.StackTrace.dll" because it was not found. [C:\BuildAgent2\
work\f7058813c1f95bba\MyProject.Web.UI\MyProject.Web.UI.csproj]

C:\Program Files\dotnet\sdk\6.0.203\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NE
T.Publish.targets(248,5): error MSB3030: Could not copy the file "C:\Users\Admi
nistrator\.nuget\packages\system.dynamic.runtime\4.3.0\lib\netstandard1.3\Syste
m.Dynamic.Runtime.dll" because it was not found. [C:\BuildAgent2\work\f7058813c
1f95bba\MyProject.Web.UI\MyProject.Web.UI.csproj]

 

 

 

 

 

 

1 comment
Comment actions Permalink

Update:

Tried a lot off different things and read that TeamCity will start to "clean up" NuGet packages if disk space is getting low. This might be what happened here since we only had about 3-4 GB free space.

I did a couple of thing but to be honest I'm not sure which that really solved the issue.

  • Cleaned up the disk, now have over 50 GB free
  • Restarted TeamCity from the "Administration -> Diagnostics" view.
  • Executed the build but with the --force parameter.  Like "C:\Program Files\dotnet\dotnet.exe" publish C:\BuildAgent2\work\f7058813c1f95bba\MyProject.Web.UI\MyProject.Web.UI.csproj --configuration Release --force

Now the packages are restored and the errors are gone =D

I hate when things just starts to work without me knowing why it started to work again =/ But this is whats most important atm.



Tried with restarting TeamCity

0

Please sign in to leave a comment.