Unable to load one or more of the requested types

I was getting my build script up-to-date with my WPF additions to Walnut today. I already had the “press F5 and run in Visual Studio” configuration working, now I just needed to make my release build script work so I could continue to package up test releases into an installer.

After I ran the build, I was getting this error: “Unable to load one or more of the requested types”, this is related to the reflection I use to dynamically load either the WinForms shell assembly, or the WPF shell assembly. It was crapping out when trying to iterate over the types in the WPF assembly.

Between some googling and inspecting the build log file, I figured out the issue. The build script first builds  Walnut.exe, then Walnut.WPFShell.dll, then Walnut.Shell.dll.  I found that each shell assembly was rebuilding the Walnut.exe file, because each project in Visual Studio had a reference to that project, so it would force a rebuild. What happens is the version of Walnut.exe is changed when the second shell assembly compiles, which screws up the first shell assembly, it gets confused by the new version number.
The fix was to remove the Walnut.Core project reference from both shell assemblies in my MSBuild files and instead just reference the Walnut.exe file that I know exists in the build directory.

2 Comments so far »

  1. Devendra said,

    Wrote on April 2, 2007 @ 9:56 pm

    hi ben,
    i m also suffering from the same problem but i got this message when i was trying to install the project on a computer having only .net framework 2.0 installed ( not complete setup of visual studio 2005 ) i.e. on standalone pc. but on same machine if i try to install setup of simple program like “Hello world” then it is working properly.
    If you have any solution to this problem then please mail me on my id given.
    Thanks and regards,
    Devendra

  2. Ben said,

    Wrote on April 3, 2007 @ 7:14 am

    I’m not sure why that would cause a problem, all I know is that the error for me was a reference to an “outdated” assembly, so I would look into that.

Comment RSS · TrackBack URI

Leave a Comment

Name: (Required)

E-mail: (Required)

Website:

Enter my name (ben) in this box, so I know you're a human.

Comment: