Unable to get an MVVMLight project working after doing a merge with source control?
Mar
23
Written by:
Sunday, March 23, 2014 2:29 PM
Did you just merge a bunch of changes in source control, but now your project won’t compile? Getting a bunch of GalaSoft namespaces not being referenced errors upon compiling? I think I have something you can try to help!
Last week, I worked on an older code branch. Later in the week, we merged a bunch of work into the main\current code branch. My boss did most of the work, but after many comparing TFS DataSets, merges, checkins, rinse and repeat….the project wouldn’t work. HUH? If you’re doing A BUNCH (ie LOTS) of code merges that happened over many days\weeks (hey, you’ve done it too, don’t judge LOL) you sometimes skip the F6 (Compile) step just to keep plugging along to get the task\job done.
Well, Fri, I went to try things out (F5ing) but …..DOH!……Errors
Ok, go look at the References for the project. Huh? Where’d the MVVMLight refs goto from GalaSoft? Huh?
Ok, I know NUGET is new to me, buuuuuuuuut. Ok, not time to panic yet, go look at the nuget manage packages tool. DOH! It SAYS it’s supposed to be there!
Ok, maybe, something got screwed up in the merging? Possible. So lets go and reinstall the nuget package.
DOH! Already installed. Ok, ok, let’s go back to basics, we’ll just uninstall mvvmlight package and then reinstall it. Hey, it’s not working now, what’s the worst that can happen? (Don’t answer that!!!!!!!!!!!! LOL)
In the nuget Package Manager Console, type out what’s on the first line (uninstall-package mvvmlight). There’s another one there cause I might have done that second one while doing previous testing above, so I thought I would uninstall it for completeness. If we go look at the Manage NuGetPackages program, you should see it not listed, this is good, although your heart just skipped a beat, I know, I know, don’t worry, just keep going\reading!
Next, go into the Package Manager Console and install the mvvmlight again! (install-package mvvmlightlibs) I did the libs cause…….I picked one and I wanted the smallest piece available (you now know how to “fix” this if you wanted the other one, you know how to uninstall this one and install the other one).
Ok, NOW let’s go check the project references to see if they’re listed now? BINGO!!!!!!!!!!!!!!!!!!!!!!!!!! AWESOME! BUT! The proof, the REAL proof is for the F6 for compiling!!!!!!!!! YUP! Works like a charm!
COOL! Now that you know how to FIX this, what COULD be the source of the problem? I think it might be related to the merge activity, TFS hiding certain files, and maybe nuget not counting certain files in the merge? For example, I noticed the merge didn’t pick up the packages.config file for nuget, but when I did the package install, it did. Maybe that could be it?
Cool! Now you know to “fix” a project that’s not compiling from a missing mvvmlight nuget package\reference, it’s time to grab a coffee and get coding!