Why do I receive "Excel primary interop assembly is not found" error when creating Excel add-in client for MPS?

14 Ansichten (letzte 30 Tage)
I am unable to compile an Excel add-in client for MATLAB Production Server (MPS) when using the Windows SDK 7.1 compiler and instead receive the below compilation error:
ERROR: Excel primary interop assembly is not found.

Akzeptierte Antwort

MathWorks Support Team
MathWorks Support Team am 30 Okt. 2023
Bearbeitet: MathWorks Support Team am 1 Nov. 2023
Compiling the MPS Excel add-in works differently than a regular Excel add-in.  It requires the Microsoft Office Primary Interop Assembly package.  This can be obtained in the following ways:
1.  Installed with Visual Studio
2.  For Office 2007 or Office 2010, it can be installed if the ".NET Programmability Support" box is checked during installation
3.  For Office 2013 or later, it is installed by default with Office.
4.  Downloaded directly from Microsoft's site:
https://www.microsoft.com/en-us/download/details.aspx?id=3508 (Office 2010)
For more information, check:
https://msdn.microsoft.com/en-us/library/vstudio/kh3965hw%28v=vs.100%29.aspx
However, MATLAB only sees the assembly if it is installed with Visual Studio (first case above).  As such, the error manifests if you try to use Windows SDK 7.1 without Visual Studio installed.  To fix the error, the interop assembly needs to be copied from the Global Assembly Cache (GAC) to the Visual Studio folder.  To do this:
1.  Make sure that the interop assemblies are installed through one of the methods above.  This can be confirmed by opening the folder at:
C:\Windows\assembly
and see if Microsoft.Office.Interop.Excel is listed.  Note the Version and the Public Key Token values.  Version could be 12.x.x.x (Office 2007), 14.x.x.x (Office 2010), or 15.x.x.x (Office 2013).
2.  Open the Windows Command Prompt and run the following command:
copy "C:\Windows\Assembly\GAC_MSIL\Microsoft.Office.Interop.Excel\<Version>__<Public_Key_Token>\Microsoft.Office.Interop.Excel.dll" "C:\Program Files (x86)\Microsoft Visual Studio 10.0\Visual Studio Tools for Office\PIA\<OfficeVersion>"
Note the <Version> and <Public_Key_Token> placeholders above.  They should be the same as the values seen in Step 1.  Depending on whether you have Office 2007 or Office 2010, <OfficeVersion> should be "Office12" or "Office14" respectively.  With Office 2013, you can use the following destination path:
C:\Program Files (x86)\Microsoft Visual Studio 12.0\Visual Studio Tools for Office\PIA\Office15
The destination folder should be created manually if it does not exist.

Weitere Antworten (0)

Kategorien

Mehr zu Installation finden Sie in Help Center und File Exchange

Produkte


Version

R2014a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by