tags:

views:

422

answers:

5

A strange error begans to happen with my XNA project on a new pc. I have two projects on the solution and a library that is used by both of them. One of the projects, a XNA Game Project, runs perfectly. The other project is a mix of WindowsForm and XNA. The form launches a XNA class when a button is clicked. When I run the program, it works great till the moment I click the button which launch the XNA class. A FileNotFoundException is fired exactly at the moment that the constructor will be executed.

System.IO.FileNotFoundException was unhandled   Message="Could not load file or assembly 'Microsoft.Xna.Framework, Version=3.0.0.0, Culture=neutral, PublicKeyToken=6d5c3888ef60e27d' or one of its dependencies. The system cannot find the path specified."

The reference is correct, there is no problem on compilation. We already tried to delete the reference and add it again but it didn't work. Everything worked correctly in others teammate's pc.

Anyone has any idea what is the problem?

+2  A: 

Check your config file for references to this dll. It is most likey a type being loaded via reflection. I see these types of errors with the Ent Lib.

If this File is in the GAC on your teammate's machine or if you have different config files, this error will not show up.

HTH

Brian

brian chandley
I checked the GAC, and the there is a right reference there. For config file do you mean the csproj file?
Gustavo Cardoso
Actually, I meant your app.config.
brian chandley
+1  A: 

You can try using depends.exe from the platform sdk, to investigate a missing dependency. I assume you have manually verified the file was in the right folder?

Also, there are apparently issues with this dll on x64

Joepro
I check the file. What i didn't undestand is why only this project fire the error. Both project uses XNA's library. Thank you for the help, I don't have depends.exe, but I'll look for one.
Gustavo Cardoso
A: 

I solve the problem with a workaround:

I create a new XNA project and move everything to there, then I added the references to WindowsForm. The assembly problem didn't happen anymore!

Thank you for all the help.

Gustavo Cardoso
A: 

You can use fuslogvw or any of the other things mentioned to find the root cause. You can also trap the AssemblyResolve event and manually load the assembly in the From or Neither context.

+1  A: 

Hey Gustavo, sounds like you had this a long time ago:

http://blogs.msdn.com/b/shawnhar/archive/2008/02/25/xna-framework-on-64-bit-windows.aspx

Sounds like the CLR was trying to look for a 64-bit version of XNA, for which there is none, this is why creating a new project as XNA Project works, since those default to 32-bits.

Just leaving it here for reference, also, close this question already, choose an answer. :3

Aru
I have been a while, but your hint was correct. Thank you
Gustavo Cardoso