I have an application which references the assembly "Microsoft.Xna.Framework, Version=2.0.0.0, Culture=neutral, PublicKeyToken=6d5c3888ef60e27d". I have created an installer project that installs this assembly in the GAC (by running the XNA redist installer).
However, when this assembly is first used, I receive an exception during JITing. I then tried to ngen the image, and ngen gives the following error message:
Failed to load dependency Microsoft.Xna.Framework of assembly x,
Version=1.0.0.0, Culture=neutral, PublicKeyToken=null because of the following
error : The specified module could not be found. (Exception from HRESULT: 0x8007007E)
Note that the version is 1.0.0.0 and the PublicKeyToken is missing, and bogus assembly does not exist. What can cause the JITer and ngen to attempt to load this bad version of the assembly?
The correct version of the assembly is in the GAC. I have opened my image in Reflector, and the reference shows correctly there. I have also verified that no other assembly in the dependency hierarchy loads the bogus 1.0.0.0 version. In fact, the 1.0.0.0 version does not exist anywhere, neither on the development box nor the test machine.
However, when trying to expand the reference to Microsoft.Xna.Framework on the test machine, Reflector thinks (correctly) that the referenced assembly version is 2.0.0.0, but it can not find it even though I can see it in the GAC when viewing c:\windows\assembly in explorer.
This problem is driving me crazy, I'm getting nowhere with it.