views:

327

answers:

2

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.

A: 

Copy Local on the reference maybe?

Pondidum
The referenced assembly is meant to be in the GAC, I can see it in c:\windows\assembly.
erikkallen
A: 

(note - pre-dates edit re external 1.0 dlls)

Are you using any external dlls? Perhaps some 3rd-party xna dll that is referencing the 1.0 version. If this gets discovered first, all bets may be off. Try looking at any external dlls in reflector, so see what version they reference. You could also try adding a version policy for the xna dll.

Marc Gravell
Thanks for the sugggestion of the dependency hierarchy, but unfortunately it did not help. I updated the question.I also checked the version policy option, but it seems that it can't help me since I have to change both the version and the public key token.
erikkallen