0

I have a dependency on specific nuget package. When I update my solution to use new package version and commit/push solution to remote GIT repository, other contributors to solution, after pull, are still using old DLL version of nuget package, even though package-restore is activated. However, when they open CSPROJ file, it shows that reference should be to the new version. Basically Visual Studio is not generating any warning/error if there is a mismatch between used DLL from bin/obj folder and referenced DLL in csproj file. To be more concise:

  1. Solution uses DLL version 0.5
  2. I upgrade via Nuget to DLL version 0.6
  3. My Visual Studio shows that version 0.6 is used
  4. I commit/push solution to GIT
  5. Another colleague pulls solution from GIT
  6. His Visual Studio shows DLL version 0.5, there is no error/warning
  7. His CSPROJ file references DLL version 0.6
  8. Solution fails on runtime as there is change in internal implementation

How do we fix this:

  1. Colleague deletes his bin/obj
  2. Visual Studio notices that DLL's are missing
  3. He uses Manage Nuget Packages on solution level and just clicks OK, nothing else
  4. Nuget downloads DLL's and issue is solved

Now this is really stupid workaround and in my opinion this should be automated. Is there anything that we might be doing wrong that is causing this to happen?

Admir Tuzović
  • 10,517
  • 7
  • 31
  • 69
  • Idea : The other developer can run the "Update" command from the power-shell command line. This is one of those "darned if you do, darned if you don't" on the functionality. Because if it were auto-voodoo'ed, then your (other developer) would not know a version change had happened. Aka, the other developer may want to know exactly when the change occurred, and this inconvenience lets him or her know...... Try the UPDATE command........ – granadaCoder Oct 10 '13 at 14:56
  • Does developer2 do a build after step 7? Does it not copy the updated binary to the bin/obj folder? – Deepak Oct 11 '13 at 23:07
  • Yes, they do a build and nothing happens. However when they delete their bin/obj folders (which are not under version control), they get build errors. After that Manage Nuget Packages for Solution triggers background download. – Admir Tuzović Oct 12 '13 at 14:47

1 Answers1

1

GIT for VS doesn't take into consideration nugget packages (neither build generated files in \obj and \bin folders).

For Git to manage packages for versioning edit .gitignore file by commenting (#) line below :

# Enable "build/" folder in the NuGet Packages folder since NuGet packages use it for MSBuild targets
#!packages/*/build/

(nb : if you want to backup and rename .gitignore file, go there)

Pradeep
  • 8,641
  • 13
  • 23
  • 33
Antoine Meltzheim
  • 8,525
  • 6
  • 31
  • 39