Teamcity plugin - publish fails with a very long path in error


We are using Teamcity plugin together with Octopus deploy for a .NET Core project. We upgraded to latest version of Octopus and latest Teamcity plugin.
The first few deployments worked fine until one day, it fails saying that it cannot find the file. The patch looks ugly, it looks like the output directory was added to the path after each build until it reached the max supported length (the output directory was “webpos-published”
We tried to changed the path to “.” but the build still fails on the agents that got error previously, the path was cached somewhere I guess. Also setting to “.” will make it pack everything and make a huge package, so we need to fix so that we can specify a directory to publish.

C:\Program Files\dotnet\sdk\2.1.401\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Publish.targets(140,5): error MSB3030: Could not copy the file “C:\BuildAgent\work\f2d3cafdfcf2f634\webpos-published\webpos-published\webpos-published\webpos-published\webpos-published\webpos-published\webpos-published\webpos-published\webpos-published\webpos-published\webpos-published\webpos-published\webpos-published\package-lock.json” because it was not found.

We can close the issue. I thought it was an Octopus step, but it actually was a .NET CLI step and does not seems to relate to Octopus deploy.

This blog post we released recently may be of some assistance. One thing I noted with the Output directory on that publish step is that it is relative to the folder containing the csproj file, and I had much less trouble all round by publishing into a folder at a higher than that (e.g. I use a folder called published off the root of the checkout folder).

Another thing that could be worth looking into is the TeamCity option to “delete all files in the checkout directory before the build”, this would prevent the content of previous build runs interfering.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.