views:

481

answers:

3

I created very simple Context Menu using Shell Extension in C#. It works fine under Windows XP 32 bit but under Windows 7 64 bits menu items not appearing.

I tried to build Setup output to x64 but no effect.

Simple Source contains ContextMenu and Setup project is under http://bit.ly/9nGd41

Looks like Wow6432 should be handled by Setup project, same for registration and adding to Global Assembly Cache

I would be appreciate for help / suggestions with this issue.

+1  A: 

Check the DLL's platform in Visual Studio and make sure it's 64-bit. 64-bit processes can't load 32-bit DLLs into their process space (and vice versa, naturally).

To build a 64-bit version of your DLL, use Visual Studio's Configuration Manager to create a new solution platform. Select X64 (instead of X86 or any platform), and rebuild the project. There are also command-line switches for C# compiler, if you are using scripted builds.

John Rudy
I also tried this but then I have "BadImageFormatException was unhandled", and recomended solution for this is to change build for x86
Smejda
What are your references? Do you reference any 32-bit DLLs in your project? That will limit your 64-bit Windows Explorer compatibility.
John Rudy
I'm using ShellExtension so belive he is using Shell32.dll which is 32-bit DLL.
Smejda
+2  A: 

I have to strongly recommend you stay away from any code written by Esposito. As usual, his P/Invoke declarations in the ShellExt folder are completely wrong, they cannot work in 64-bit code. Publishing this code was very irresponsible in the first place, shell extensions should never use a .NET CLR version before 4.0. Visit pinvoke.net if you want to rescue it.

Hans Passant
I wrote this in C++ as recommended, no problems at all, thx for usefull advice :)
Smejda
A: 

Hi, I'd the same problem. You need to change InstallUtil.dll in your setup file. I wrote a article in my blog about it. http://artyomgrigor.wordpress.com/2010/10/06/register-shell-extension-context-menu-also-on-windows-x64-part-2/