Async nuget publish fails build as dependent builds start before nuget available
Trying to move towards .NET standard / .NET core, and taking advantage of the new functionality to be able to depend on 1.0.* we thought we'd try to build these bits using nuget dependencies, enabling devs to be able to build without any custom scripts to get artifacts from Team City
So we have project A and B where B has a snapshot dependency on A, and needs the Nuget package published by building A. Sadly, builds of B often fail due to newest nuget from project A not being available yet.
How can we get build of B delayed until snapshot dependency nugets are actually available?
Should I create a bug? Or is this possible somehow?
Please sign in to leave a comment.
Hi Hakon,
In order to understand better what is going on, we would need to know how you are publishing the packages. Otherwise, you should be able to use the Nuget Publish step explicitly, which should help with that. If that still doesn't help, please give us a more detailed description of how you publish the packages and how you load them back up in the second build.
Hi..
For our root project we've configured NuGet Feed:
Automatic NuGet packages indexing: enabled
This seems to publish any generated .nupkg artifact our build configurations produce as artifacts.
I failed to get the built in NuGet Pack target to work for me, so I ended up creating the package myself using powershell script calling something like:
dotnet pack my\project\dir\foo\foo.csproj -p:PackageVersion=1.0.%build.number% -p:NoBuild=true -p:TargetFrameworks=netstandard2.0 -p:SolutionDir=my\solution\dir -o %teamcity.build.workingDir%
Are you suggesting that if I change the NuGet Feed config to not be automatic, and use the NuGet publish step, publishing should no longer be async? If so I'll try to get that tested out
Hi Hakon,
Sorry for the delay, did the suggestion work? The Nuget Publish step aims to publish directly to the feed, while using the automatic indexing needs to wait until artifacts are published before indexing them, and that might happen once the new build has already began, which could lead to the issues you are experiencing.
Have turned automatic indexing of and made nuget publish step now. I failed to publish *.nupkg. Got complaints about handling of symbols packages not being good, and then 409 on publish. But then I specify only the non-symbol packages specifically it seems to work. I'll monitor a while and see if I see any build failures due to package not being available yet, but sounds like this should solve it.
Thanks for the reply..