We have an application containing several unmanaged DLLs that has been built in a 32-bit environment. I recently added a .NET remoting module (packaged in a DLL which I cleverly called Remote.dll) to allow our customers to develop applications that can
connect to and control our application. As part of our delivery, I created a sample C# .NET application. All of this works fine on 32-bit machines.
Our main application works just fine on Vista 64 and Windows 7. However, I tried to get my sample .NET remoting application to work on Vista 64 and it crashes. So I transferred my sample application code to the 64-bit machine and built it. When running in
the debugger, I get
"An unhandled exception of type 'System.BadImageFormatException' occurred in MySampleApp.exe"
"Additional information: Could not load file or assembly 'Remote, Version=184.108.40.206, Culture=neutral, PublicKeyToken=null' or one of its dependencies. An attempt was made to load a program with an incorrect format"
I had been building the sample application with the Platform Target as Any CPU. If I change this to x86, I get the following error when I try to run:
"An unhandled exception of type 'System.IO.FileNotFoundException' occurred in MySampleApp.exe"
"Additional information: The specified module could not be found. (Exception from HRESULT:0x8007007E)"
I have tried moving the main application to the 64-bit machine and building. The main application runs fine, but the sample application still crashes.
I even changed the output location of my sample application to be in the folder where the main application resides, just in case there was a dependency on the main application that I wasn't aware of. Still no go.
Also, in the development environment (VS2008), after adding a reference to my .NET remoting DLL, I can browse it just fine. So this doesn't seem to me to be a build-time problem.
But what do I know? I'm the one who can't get the stupid thing to work!
Thanks for any help!