The located assembly’s manifest definition does not match the assembly reference
September 30, 2006
I doubt that this post will really help anyone since the error message “Could not load file or assembly … or one of its dependencies. The located assembly’s manifest definition does not match the assembly reference.” could be caused by any number of scenarios. However, I’ve gotten burned twice by the exact same scenario and have run around in circles for several hours total so I just wanted to make a note of it as a reminder to myself.
I can’t recall if both times it was dealing with the same projects and assemblies or not, but I kind of think it might have been the case. In the most recent scenario, I was having to rebuild the web controls assembly for the project we use for handling recurrence in MyHomePoint. Although it is a third party solution, the source code is provided and we have been in and out of the code several times making custom adjustments for our needs. In the recurrence project, we had replaced the standard date controls with date controls from another third party a while back with good luck. This time around, there was an update to the date controls project so we just needed to update the reference, rebuild the recurrence project, and then rebuild the MyHP web app. No big deal, right?
Except, that I kept getting the message that the manifest didn’t match the assembly reference when accessing certain pages (it builds just fine). OK, fair enough, we’ve got a number of moving parts at the moment so I probably didn’t have something in the correct place. Thus begins the process of verifying and re-verifying that everything looks correct.
Let me verify that I do indeed have the latest date control assembly… That looks OK, maybe I screwed up the reference on the recurrence project somehow… Let’s try adding the reference again… The test cycle takes five minutes once a change is made… Nope, that didn’t work. Maybe I’m not getting the new recurrence project into the web site (we have a one click build process which helps eliminate that uncertainty)… Everything seems to be OK. All the assemblies in /bin look correct… This verification and double-checking process repeats for a while, until it slowly starts to feel familiar. What was it that one time that this happened? I use TextPad and other methods to verify that the version info it is looking for isn’t embedded somewhere… No dice. Why isn’t this working?! After one round I notice that the Version of the date control assembly is not listed correctly in the recurrence reference properties. OK, I’m pretty sure I verified that. I’ll just update it (again) and rebuild… What? Why is it still not working? I updated the reference so the Version is correct. Except, it wasn’t. Hmmm. What’s going on here? Let’s try it again. Remove reference. Add reference. Navigate to the assembly I know I want (because I’ve already verified it 5 times). Click OK. Very interesting. Even though I know I went to the correct assembly, it still shows the wrong info. Why is that?
I examine the .csproj file and everything is as expected. The reference for that assembly is correct and the HintPath points to the correct location. By this time, I’m pretty sure it is something at the project/solution level so I just need to do a little more digging. I can’t imagine that the .csproj.user would have anything useful since that should just be settings specific to me. But what is this entry for ReferencePath? It has a number of paths listed to various assemblies and the last path listed is the location of our v1 of MyHP. I wonder if that setting could be causing the reference to point to the assembly in that location (even though I just navigated to the assembly I want and it is listed correctly in the .csproj file)? I could muck around with the file, but I’m just going to delete the .csproj.user file totally and let it get rebuilt. Close and re-open my project, and what do you know? The Version info is correct for the date assembly! Yay!
So, short version of all that is that if you are running into weird reference issues, you might consider double-checking what is in your project user file. Oh, and one final note: we are using the VS2005 Web Application project model, so not sure if this is something that would be specific to that, or also to the Web Site model as well.
Hope this helps! I know it will help me in the future.
Popularity: 3% [?]
Comments
3 Responses to “The located assembly’s manifest definition does not match the assembly reference”
Got something to say?
I’m having the same problem in a WinForms app and it isn’t the .user file. I still haven’t found out what it is, but it’s driving me crazy.
I am having same issue, not the .user file. Deleted them all; still same issue.
I changed these to same assembly value of my main project:
[assembly: AssemblyVersion(”1.0.*”)]
[assembly: AssemblyFileVersion(”1.0.*”)]
That helped compiling, however other issues occur: like reports customer dll’s.