سؤال

I have built an add-in for office 2010 using VS 2010. I have followed these steps to create the msi but when I tried to install it with office 2013 I get an error telling me that:

"A required component for interacting with excel is not available..."

Do I need to link to office 2013 assemblies to deploy for office 2013?

EDIT: It says here that using VSTO V4 should make it compatible but it still doesn't work.

هل كانت مفيدة؟

المحلول

You have yourself created a Windows Installer Launcher condition that produces the mentioned error, following the mentioned tutorial. You should remove the condition that checks for the particluar PIA component by Component ID.

Condiotions to remove

Rather than check and produce false errors, add VSTO and PIA as a prerequisite and you can also include it in your setup:

enter image description here

You will have to download Microsoft Office 2010 Primary Interop Assemblies Bootstrapper Package and install it on your development machine. This enables you to add PIA 2010 as a prerequisite in setup project, which is what you need.

Also if you need to include PIA 2010 within your installation, you will have to copy Microsoft Office 2010: Primary Interop Assemblies Redistributable (all the extracted files) to C:\Program Files\Microsoft SDKs\Windows\v7.0A\Bootstrapper\Packages\Office2010PIARedist.

Your setup will then look something like this:

enter image description here

No, you do not need to link 2013 PIA to make your solution work in Office 2013, VSTO and PIA 2010 should work with Excel 2013 - but the extra functionality of Excel 2013 app is naturally missing there. But you would need to upgrade to VS 2012 or 2013 if you would like to use VSTO 2012.

So you can keep using VSTO 2010 for Office 2013.

But also look at this article.

When you compile an add-in project that targets the .NET Framework 4, by default the type information for all the PIA types referenced in the add-in code is embedded in the add-in assembly. At run time, this type information is used to resolve calls to the underlying COM type, rather than relying on type information in the PIAs.

So after all it means that if you target .NET 4 you do not have to worry about PIA on a target computer at all. So you also do not need to add Microsoft Office 2010 PIA as a prerequisite. Still you will need VSTO runtime prerequisite.

Just check, that you reference to Microsoft.Office.Interop.Excel has the correct version and EmbedInteropTypes set to true:

enter image description here

This is a really good reason to delete those Search for Office 2010 Shared PIA conditions.


Remark: It seems that the problematic Windows Installer Launcher condition works when I enter another component ID form here, namely {FAB10E66-B22C-4274-8647-7CA1BA5EF30F}. It is Office 2007 component ID. I have tested it with Office 2007 and Office 2013 and both setups proceeded without any error and the add-in is working.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top