Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I don't see a problem with your approach either. </p> <p>Typically VS will generate an interop assembly for COM components automatically when you add a reference to the component. However, when you add a reference to one of the Office components (XP or any later version), a reference to the pregenerated (and optimized) primary interop assembly from Microsoft is added as in your first example. The line </p> <pre><code>&lt;WrapperTool&gt;primary&lt;/WrapperTool&gt; </code></pre> <p>means that this PIA is used.</p> <p>If you correctly added the PIA reference the <em>CopyLocal</em> property of this reference should be set to false and the <em>Path</em> property should be something like</p> <pre><code>C:\WINDOWS\assembly\GAC\Microsoft.Office.Interop.Excel\12.0.0.0__71e9bce111e9429c\Microsoft.Office.Interop.Excel.dll </code></pre> <p>You will find some more details on interop assemblies in this MSDN <a href="http://msdn.microsoft.com/en-us/library/aa679806.aspx" rel="noreferrer">article</a>.</p> <p>To get the first method working it is necessary that the Office Primary Interop Assemblies (PIAs) are installed on the machine. There is a redistributable version available from Microsoft: </p> <ul> <li><a href="http://www.microsoft.com/downloads/details.aspx?FamilyId=3C9A983A-AC14-4125-8BA0-D36D67E0F4AD&amp;displaylang=en" rel="noreferrer">Office 2003 PIAs</a></li> <li><a href="http://www.microsoft.com/downloads/details.aspx?familyid=59DAEBAA-BED4-4282-A28C-B864D8BFA513&amp;displaylang=en" rel="noreferrer">Office 2007 PIAs</a></li> </ul> <p>AFAIK, these PIAs only get installed by the Office setup when the .NET Framework has already been installed, that's why there is a separate redistributable for the PIAs.</p> <p>Note: Make sure that you reference the version of Office that you are targeting. When targeting several versions of Office, you might get some problems however. A solution in that case might be late binding (if performance is not an issue).</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload