none
Can't see Office.Interop namespace when importing RRS feed

  • Question

  • I use VS 2008. Have just upgraded my Office to 2010. Installed PIA redistributable package after upgrading Office. I did ask for VS Dev tools to be included when installing Office.

    Checked that Microsoft.Office.Interop.* 14.0.0.0 files exist in C:\WINDOWS\assembly

    When adding references from the COM tab, I can see MS Office 14.0 Object Library and MS Outlook 14.0 Object Library etc. Under the .Net tab I can see Microsoft.Office.Interop.Outlook 12.0.0.0 and no higher version

    No matter what references I add, I can't get the Microsoft.Interop.* namespaces when Importing at the top of my code.


    • Edited by macowl Friday, September 7, 2012 4:53 AM
    Friday, September 7, 2012 4:20 AM

Answers

  • Hi macowl

    Everything stored in the GAC will appear in the COM tab. The redistributable targets the client, not the developer machine and therefore installs the PIAs in the GAC. The same when you install Office and ensure that .NET Programmability support is included in the installation.

    The entries in the .NET tab don't come from installing Office, but from installing Visual Studio. Since Office 2010 was not part of VS 2008, there are no PIAs installed for 2010 in the Visual Studio .NET folders. That's where the Office entries for the .NET tab come from. As far as I know, you'd need to upgrade to VS 2010 in order to see the Office 2010 entries listed in the .NET tab.

    FWIW I had a few bad experiences with references "getting lost" when using the .NET tab to set references to PIAs. I always use the COM tab.


    Cindy Meister, VSTO/Word MVP, my blog

    Friday, September 7, 2012 5:31 AM
    Moderator
  • Hi macowl

    I can't recall having ever encountered anything like this before, and I'm not sure the VSTO forum is going to be able to help you solve this, in the end, as the problem seems to be at a deeper level.

    Sometimes the parallel installation of the redistributable can cause problems...

    At this point, in your place, I'd probably try uninstalling the PIA redistributable, Office 2010 and Visual Studio. If the Office PIAs are still present in the GAC use gacutil.exe from the Command Line to remove them before uninstalling Visual Studio. Restart Windows and then try re-installing, first Office 2010, then Visual Studio. Office should, by default, install the PIAs into the GAC without any special action on your part.

    Start a new project (Windows forms, preferably), set a Reference to an Office application, then see if you can get Microsoft.Office-Intellisense?


    Cindy Meister, VSTO/Word MVP, my blog

    Monday, September 10, 2012 10:42 AM
    Moderator
  • Thanks for the help.

    I installed VS2010 which fixed the problem. Yeeha!!

    Wednesday, September 12, 2012 10:49 AM

All replies

  • Hi macowl

    Everything stored in the GAC will appear in the COM tab. The redistributable targets the client, not the developer machine and therefore installs the PIAs in the GAC. The same when you install Office and ensure that .NET Programmability support is included in the installation.

    The entries in the .NET tab don't come from installing Office, but from installing Visual Studio. Since Office 2010 was not part of VS 2008, there are no PIAs installed for 2010 in the Visual Studio .NET folders. That's where the Office entries for the .NET tab come from. As far as I know, you'd need to upgrade to VS 2010 in order to see the Office 2010 entries listed in the .NET tab.

    FWIW I had a few bad experiences with references "getting lost" when using the .NET tab to set references to PIAs. I always use the COM tab.


    Cindy Meister, VSTO/Word MVP, my blog

    Friday, September 7, 2012 5:31 AM
    Moderator
  • Problem i'm having is; when I add a reference from even the com tab, I can't get a reference to the assembly in my code.

    Imports Microsoft.Interop."anything" does not work. The Microsoft.Interop namespace is not available.

    I may just upgrade to VS2010.

    Friday, September 7, 2012 6:06 AM
  • Hi macowl

    Given the problem you describe, if I'm understanding it correctly, upgrading to VS 2010 probably won't make a difference.

    Exactly which version(s) of Office are actually installed on your machine? Not the PIAs; Office, as being able to start and work with Word, Excel, etc.?


    Cindy Meister, VSTO/Word MVP, my blog

    Friday, September 7, 2012 8:53 AM
    Moderator
  • I have Visual Studio 2008

    Previously I had Office 2003 and all worked fine.

    I have now upgraded my Office to 2010, full install with developer bits and all.

    That did not work so I installed the PIAs.

    So now I have a reference to (for eg):

    Microsoft Office 14.0 Object Library
    C:\WINDOWS\assembly\GAC_MSIL\Office\14.0.0.0__71e9bce111e9429c\Office.dll

    and

    Microsoft Outlook 14.0 Object Library
    C:\WINDOWS\assembly\GAC_MSIL\Microsoft.Office.Interop.Outlook\14.0.0.0__71e9bce111e9429c\Microsoft.Office.Interop.Outlook.dll

    but

    Imports Outlook = Microsoft.Office.interop.Outlook

    or simply:

    Imports Microsoft.Office

    Do not work. IntelliT does not offer Office as an option.

    This is the same for Word and Excel

    Monday, September 10, 2012 9:56 AM
  • Hi macowl

    I can't recall having ever encountered anything like this before, and I'm not sure the VSTO forum is going to be able to help you solve this, in the end, as the problem seems to be at a deeper level.

    Sometimes the parallel installation of the redistributable can cause problems...

    At this point, in your place, I'd probably try uninstalling the PIA redistributable, Office 2010 and Visual Studio. If the Office PIAs are still present in the GAC use gacutil.exe from the Command Line to remove them before uninstalling Visual Studio. Restart Windows and then try re-installing, first Office 2010, then Visual Studio. Office should, by default, install the PIAs into the GAC without any special action on your part.

    Start a new project (Windows forms, preferably), set a Reference to an Office application, then see if you can get Microsoft.Office-Intellisense?


    Cindy Meister, VSTO/Word MVP, my blog

    Monday, September 10, 2012 10:42 AM
    Moderator
  • Thanks for the help.

    I installed VS2010 which fixed the problem. Yeeha!!

    Wednesday, September 12, 2012 10:49 AM