Click here to Skip to main content
15,881,248 members
Please Sign up or sign in to vote.
3.00/5 (2 votes)
I am trying to run this project in my VisualStudio 2010.
it build and run fine on my 64 bit Machine.
NOTE: I have to change build Platform of my project to x86.

my problem is when I try to run compiled assembly (after moving Debug Folder to another 64 Bit machine) I couldn't run my project. my exe breaks down when I open it.


as per my understanding problem is because of three DLL used in project are 32 BIT and Machine is 64Bit.

NOTE: below is three DLL
VB
Interop.Office.dll

Interop.VBIDE.dll

Interop.Word.dll


I googled much but couldn't found any solution?
one solution comes in my mind is manage to get 64BIT version of above DLL for that also I have googled much but couldn't get anything.
could you please help me to find solution for this problem? or is there any way to found 64BIT version of above DLL?

Please Help me
Posted

The GAC assemblies of the proper version of the instruction-set architecture are referenced if you add a reference is a correct way, via the tag ".NET" of the "Add Reference" Window. You should never try to "find" it and add reference by the file name of the assemblies executable module (PE file). The referenced to GAC assemblies are based on strong names, not locations of the file.

Please see:
http://en.wikipedia.org/wiki/Global_Assembly_Cache[^],
http://en.wikipedia.org/wiki/Strong_key[^],
http://msdn.microsoft.com/en-us/library/wd40t7ad.aspx[^],
http://msdn.microsoft.com/en-us/library/yf1d93sz.aspx[^].

All 64-bit versions of Windows can also host x86 (32-bit applications), via WoW64: http://en.wikipedia.org/wiki/WOW64[^].

You can always build an x86 version of your software which will run on "real" x86 or via WoW64. All you need to do is to set target CPU version to "x86" explicitly for the entry-point assembly (*.EXE, usually), leaving all other assemblies to be compiled to "AnyCPU" target. All you need to know is: you should never allow mixing assemblies compiled to different instruction-set architectures in one process. It will never work.

See also: http://en.wikipedia.org/wiki/Instruction_set[^].

—SA
 
Share this answer
 
It really has nothing to do with the bitness of the machine. It has everything to do with your code and which version of Office is installed.

If the user has 64-bit Office installed, the interop libraries and your code must be 64-bit also.

If the user has 32-bit Office installed, so must follow the libraries and your code.

It doesn't matter what the bitness of the machine is as 64-bit Windows will run 32-bit code just fine.
 
Share this answer
 
Comments
Pritesh Aryan 2-May-13 23:44pm    
Thank you so much for answering... but one question...
the DLL whichi i have listed in my question will be placed from which .EXE executed.
so EXE will use that DLL. how can EXE will take 64 BIT DLL if i install 64Bit version of Office.?
Dave Kreskowiak 3-May-13 7:12am    
You need two versions of your applicaiton. One compiled for 32-bit Office and one compiled for 64-bit. You cannot rely on the AutoCPU target to tell the difference as you can have 32-bit Office installed on a 64-bit machine.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900