Invalid NuGet Links When Changing Release Configuration Configuration

I have a rather strange problem with NuGet (most recent) and VS2012. I have a multi-project solution with NuGet package management enabled, and for now, I'm using the Debug | AnyCPU, all its compilations and the application work correctly. As soon as I switch to Release | AnyCPU, it looks like all the NuGet build references have disappeared and the application is clearly not compiling. Oddly enough, I see all the links in the NuGet Manager user interface for all the right projects.

Have you ever had a similar problem and do you know how to fix it?

The reconstruction did not help. NuGet links were configured when the Debug configuration was configured.

+4
source share
3 answers

Once again, I answer my question ...

The bottom line is that I am changing the structure of the solution and moving several projects. This means that you get invalid relative paths in the .csproj files for each project. This is normal if you do not change the depth of the structure, which I did.

For an unknown reason, the debugging assembly went fine with invalid paths (probably the assemblies were assembled in some other way, since I manually deleted the bin and obj folders, cleared the solution, etc.). But to build the release, he tried to get the builds from the (incorrectly referenced) packages / directory.

NO PART OF THE NuGet Process Detected / Reported This Problem In all UI consoles and even in the NuGet PowerShell console itself, everything seemed just OK.

The solution is obvious. Edit the .csproj files for the affected projects (I was actually focused on the problem, filtering out warnings and finding out only some assemblies were affected, and they were outside the main solutions directory) and changed the assembly reference paths for the correct NuGet packages folder.

On the other hand: this is a NuGet (and possibly VS) link handling issue. He tries to use some relative paths instead of adding some variable like $ {SOLUTION_ROOT} or $ {NUGET_ROOT} or $ {PACKAGES_FOLDER}. If this were done by replacing variables, the same projects could be used in several solutions without disrupting the configuration of NuGet packages. At least I did not find a way to share the same project folder with multiple solutions.

+5
source

I was able to solve this problem by uninstalling and then installing the Nuget packages that my project used.

+2
source

Late to the party, but it might help someone. This problem may occur if you change your nuget repositoryPath (possibly via nuget.config) to a different path, the middle project.

eg.

  • Nuget first pulls your packages into the default path.
  • Changed the NugetPath repository.
  • New packages will be migrated to this path, however the existing path will not be cleared (msbuild clean will not help).
  • When you create, your tooltip paths point to the original repo path and will build as packages still exist at this location.
  • (Worse) Any nuget packages added now will point to a new repo path.

As @Baron already mentioned, reinstalling will resolve this whole mess. I also recommend removing all bin / obj / packages from your working tree to make sure you don't have crud.

0
source

All Articles