0

TeamCity is changing the hintpath attribute for certain nuget packages in my csproj files. Because of this it is restoring the wrong version for the specific nuget package and I am getting build errors on the CI server. Everything works fine otherwise, even if I pull the repo myself and rebuild and restore.

Here is what I have in git:

<Reference Include="SimpleInjector, Version=3.2.3.0, Culture=neutral, PublicKeyToken=984cb50dea722e99, processorArchitecture=MSIL">
  <HintPath>..\packages\SimpleInjector.3.2.3\lib\net45\SimpleInjector.dll</HintPath>
  <Private>True</Private>
</Reference>
<Reference Include="SimpleInjector.Packaging, Version=3.2.3.0, Culture=neutral, PublicKeyToken=984cb50dea722e99, processorArchitecture=MSIL">
  <HintPath>..\packages\SimpleInjector.Packaging.3.2.3\lib\net40-client\SimpleInjector.Packaging.dll</HintPath>
  <Private>True</Private>
</Reference>

And here is what it says in TeamCity:

<Reference Include="SimpleInjector">
  <HintPath>..\packages\SimpleInjector.3.2.7\lib\net45\SimpleInjector.dll</HintPath>
</Reference>
<Reference Include="SimpleInjector.Packaging">
  <HintPath>..\packages\SimpleInjector.Packaging.3.2.7\lib\net40-client\SimpleInjector.Packaging.dll</HintPath>
</Reference>

I have no idea why this happens or how to prevent it. Anyone have experience with this issue or know of a project setting I can change to prevent it?

Carson
  • 1,169
  • 13
  • 36

1 Answers1

0

The issue was that the build configuration was set to update the nuget packages in the nuget restore build step. I was under the assumption that only cached nuget packages would update when the package.config was different than the local packages, but that is not the case. TeamCity will always update to the latest stable nuget package if it has the opportunity and that flag is set to true.

Carson
  • 1,169
  • 13
  • 36