0

I'm trying to build a .NET Core application that references a NuGet package from a custom feed (I gave up on authentication so it has anonymous access enabled).

I have a local Teamcity instance that runs a dotnet publish command. I added the --no-restore flag en prepended a dotnet restore task in the Teamcity pipeline so I can specify my custom NuGet server using a --source parameter.

My publish folder however persistently end up with "My Library" version 0.0.1 instead of the latest version 0.0.2.

I figured it would be caching and prepended the following command:

dotnet nuget locals --clear all

This actually made the dotnet restore command iterate the packages and I can see it restoring version 0.0.2. But where is this actually restored to? The following dotnet publish --no-restore command doesn't seem to take this restored version into account...

Also further inspection on NuGet caches makes it even more weird as both those locations contain the 0.0.2 version of the library... (%userprofile%\.nuget\packages and %localappdata%\NuGet\v3-cache for both my local user as well as the buildagent user)

Any help would be highly appreciated.

Ropstah
  • 17,538
  • 24
  • 120
  • 194
  • 1
    Maybe try to run this command with `--verbosity diag` flag to see what's going on. – Peska Jun 26 '18 at 18:09
  • I do see mixed "references" to both `0.0.1` and `0.0.2` appearing in the diagnostic log for `dotnet publish`. The NuGet version referenced in the log entry seems to be correctly `0.0.2` however there is a *FusionName* in assemblyname-syntax that specifies `0.0.1` in the same line... I still don't understand how this is possible though... The only place I can find the library dll with the `0.0.1` version is in the `/publish` directory from the app. If I `dotnet clear`, `dotnet restore` and `dotnet publish` "manually" (not using the agent) it just takes the right `0.0.2` version to `/publish`... – Ropstah Jun 26 '18 at 20:54
  • I was able to work around it now by adding another build step that just adds the package explicitly just before the restore. Somehow that magically fools everyone :) – Ropstah Jun 26 '18 at 20:59

0 Answers0