Installing x64 COM Addins

M

Mark Wilson

When installing Office COM addins, how can setup program tell if the
installed version of Office is a 32 bit or a 64 bit version? There seems to
be no information relating to this in the Office EXE or DLL file properties.
Should the installer look for <application_name>.EXE.MANIFEST and check to
see if the value of "processorArchitecture" is "x86" or "amd64" is in the
file, or is there a better way to do this?
 
K

Ken Slovak - [MVP - Outlook]

I haven't seen any information on that either, but a better place to post
this would be in one of the beta or preview groups.
 
D

David Thielen

When installing Office COM addins, how can setup program tell if the
installed version of Office is a 32 bit or a 64 bit version? There seems to
be no information relating to this in the Office EXE or DLL file properties.
Should the installer look for <application_name>.EXE.MANIFEST and check to
see if the value of "processorArchitecture" is "x86" or "amd64" is in the
file, or is there a better way to do this?

I also don't know but keep in mind that an Office AddIn is always run
in 32-bit mode (no idea why).

thanks - dave

david@[email protected]
Windward Reports -- http://www.WindwardReports.com
me -- http://dave.thielen.com

Cubicle Wars - http://www.windwardreports.com/film.htm
 
K

Ken Slovak - [MVP - Outlook]

Not in Office 2010. There will be a 64-bit Office and only 64-bit addins
will run on that. The ability to run a 64-bit OS with 32-bit Office will be
there, but if you go with 64-bit Office then the addins must be 64-bit also.
 
M

Mark Wilson

Thanks Ken.

I've not found any beta or preview newsgroups for Office 2010. However,
this is a "Managed" newsgroup so I'm expecting a reply from Microsoft in the
near future.

--
Mark Wilson



Ken Slovak - said:
I haven't seen any information on that either, but a better place to post
this would be in one of the beta or preview groups.
 
C

Colbert Zhou [MSFT]

Hello Mark,

Every binary file has information in its header that indicates whether it
is a 32 bit or 64 bit file. Usually, given a dll or exe file, we can use
the tool DumpBin to get the header information to know if it is 64 bit or
32 bit.
http://blogs.technet.com/windowshpc/archive/2009/03/27/how-to-tell-if-a-exe-
file-is-a-32-bit-or-64-bit-application-using-dumpbin.aspx

To programmatically achieve this, we can call a little Windows API
GetBinaryType,
http://msdn.microsoft.com/en-us/library/aa364819(VS.85).aspx

Best regards,
Ji Zhou
Managed MSDN Newsgroup Support Team
 
M

Mark Wilson

Thanks Colbert. DumpBin from the command line give me the kind of results I
was looking for. I'll add a call to GetBinaryType in my setup program to do
the same checks at installation time.
 
D

David Thielen

Not in Office 2010. There will be a 64-bit Office and only 64-bit addins
will run on that. The ability to run a 64-bit OS with 32-bit Office will be
there, but if you go with 64-bit Office then the addins must be 64-bit also.

We build all our AddIn code for "Any CPU" - is that sufficient? And if
we install the Office beta on Win 7 - is that the 64-bit version?

thanks - dave

david@[email protected]
Windward Reports -- http://www.WindwardReports.com
me -- http://dave.thielen.com

Cubicle Wars - http://www.windwardreports.com/film.htm
 
K

Ken Slovak - [MVP - Outlook]

I believe that you will have to target 64 bit explicitly, but so far there's
a dearth of documentation on exactly what has to be done.

Even on 64-bit OS's the default will be to install the 32-bit versions of
Office. Users will have to explicitly install the 64-bit versions, and
that's where any 32-bit addin will fail to run at all.
 
J

JVW

I have an Excel COM add-in developed originally for Office 2007, using Visual
Studio 2008 sp1. I specified "any cpu" and recently tested it with Excel
2010 64-bit. To my surprise, it worked!

Immediately after installing, the Compatibility Checker said that it might
not have installed correctly and did I want it to reinstall it to correct the
error.

I tried it both ways, that is, I ignored the error and it worked fine and
then I told it reinstall it and that worked fine, too. I also use ClickOnce
updates and they worked fine, too. I was surprised by all this because I was
expecting to have to create a 64-bit version. If anyone knows more about
this I would like to understand it better.
 
K

Ken Slovak - [MVP - Outlook]

If you compile a managed code shared addin for "any" it will work in 64-bit
Office apps. You might have to see about any PInvokes though.

However, that's only part of the story. If you are using a managed shared
addin you really should be shimming it, so it has its own AppDomain, and
won't crash other addins and they won't crash you. You can find out more
about shimming and why you should do it on the blogs of Andrew Whitechapel
and Misha Shneerson. Andrew used to be, and Misha still is, on the VSTO
team. VSTO takes care of shimming for you.

The shim wizard, written by Andrew and Misha, has 2 parts. It has a
ManagedAggregator that's c# and can be compiled for any, but the actual shim
is C++ and can't be handled that way. You need to read Misha's blog entries
on 64-bit shimming (very recent) for how to do it. That will also require 2
installers, one for 32-bit and one for 64-bit installations, so the correct
shim can be loaded.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top