Problem installing TeamCity NuGet

I am creating a project in TeamCity with NuGet package recovery enabled.

I have two build steps:

  • NuGet Installer
  • Msbuild

One of the projects has the log4net package from the official feed. (But do not hang on which package)

My problem is that TeamCity starts the first step, it does not work at the nuget-installer stage with the message: Could not find the version "2.0.3" of the package "log4net".

Therefore, having done my best to find any errors in the solution, I try:

  • Disable the NuGet installer step.
  • Run my build - which obviously fails because it has no packages (see below)
  • Enable NuGet Installer Step
  • Reun build

[Edit] Regarding step 3. MSBuild would ideally, as John H. points out, be able to rebuild packages, so I would not need the NuGet installer step. The error when I try to build a solution without the nuget installation step has something to do with the OctoPack package that I installed:

OctoPack could not be started because NuGet packages were restored before the build started, and the target file was not available when the build started. Please re-create the project to include these packages in the assembly. You may also need to ensure that your build server does not remove packages before each build.

Then he succeeds. Why?

Does anyone have an idea about my problem?

Some more background:

I guess this has something to do with the octopus deployment package. I have the octopus deploy plugin installed on the teamcity server and I checked the Run OctoPack checkbox at the MSBuild stage.

I tried uninstalling the octopack package and reinstalling without any success.

Could it be that restoring the NuGet package in the MSBuild step combined with the octopus plugin causes my problems?

[Partial permission] I still don’t know why I received an error message in the log4net package. I ran the NuGet installer as a first step in my automatic build, which in the end turned out to be the right thing related to the nature of the build.

I acknowledge that I do not (always) read β€œwhat's new” when a package is updated. When upgrading Octopack from 2.0.26 to 3.0.19, one of the changes is that you no longer need to check the .octopack folder. Therefore, I could understand why the assembly could not find the target file when it was checked.

Now I have:

  • updated to Octopack 3
  • removed .octopack folder from version control
  • (again) included the nuget installation step in teamcity

and the assembly is working fine.

Thanks for the help! I am now a more educated person :)

[Deleted] irrelevant information

+6
source share
1 answer

The solution is to start Nuget recovery before the recovery phase performed by MSBuild.

The MSBuild step stops if it needs to restore packages. Performing a restore before starting MSBuild prevents the inability to recover. This solution is discussed in this .NET Framework blog post .

The answer from the Octopus Deploy team is here .

The same issue can cause TFS to fail - see RinoTom answer here . I use Continua CI and added a command line step to start Nuget recovery before the MSBuild stage.

+3
source

All Articles