bflow
asked on
No references to Microsoft.Office.Interop Assemblies
I have a new VS2010 C# project and want to add a reference to Microsoft.Office.Interop.E xcel. Unfortunately it is not appearing in the list of references on the .Net tab when I go to add a reference. In fact there are NO references to anything beginning Microsoft.Office at all.
After much searching I found what I thought was the answer. I need to download and install the Microsoft Office 2010 Primary Interop Assemblies - Redistributable package which I duly did.
Instuctions for installing says to simply Double-click the O2010pia.msi.
However, after doing this the references are still not appearing.
It's like pulling teeth... Why is it so difficult? That's the not question I want answering:)
Your help in this matter would be gratefully appreciated.
After much searching I found what I thought was the answer. I need to download and install the Microsoft Office 2010 Primary Interop Assemblies - Redistributable package which I duly did.
Instuctions for installing says to simply Double-click the O2010pia.msi.
However, after doing this the references are still not appearing.
It's like pulling teeth... Why is it so difficult? That's the not question I want answering:)
Your help in this matter would be gratefully appreciated.
ASKER
Yes I have.
There are a few various Microsoft Office references but nothing with respect to Interop or Excel.
There are a few various Microsoft Office references but nothing with respect to Interop or Excel.
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
Instead of loosing your time with Office automation (wait for the deployment nightmare!), if you can afford it, you better switch to http://www.aspose.com/categories/.net-components/aspose.total-for-.net/default.aspx
When you reference something in the COM tab, the namespace and the name used in the tab usually do not match.
Simply reference Microsoft Excel in the COM tab, and you will get the whole Microsoft.Office.Interop.E xcel namespace.
If this does not work, it means that the interops (they are intermediary files between .NET and Office) have not been installed on development computer. They are usually installed along with Office or Visual Studio, but since they are an option than can be activated/deactivated during the installation, maybe they have been skipped. In such a case, you can install them by going through the Excel Install/Uninstall options in Programs section of the Control Panel.
Simply reference Microsoft Excel in the COM tab, and you will get the whole Microsoft.Office.Interop.E
If this does not work, it means that the interops (they are intermediary files between .NET and Office) have not been installed on development computer. They are usually installed along with Office or Visual Studio, but since they are an option than can be activated/deactivated during the installation, maybe they have been skipped. In such a case, you can install them by going through the Excel Install/Uninstall options in Programs section of the Control Panel.
ASKER
Emoreau: Thanks but no thanks. This is supposed to be a one off quick fix so buying 3rd party tools is not an option.
James: As your solution suggested and by my previous searches, the interops are installed with Office or VS. My searches concluded that I re-install any missing features from the Office Install disk. I did this but was not happy with the options offered. There was no obvious check boxes to select or deselect features and the interopt options 'appeared' to have been installed. I still went through the process but it had no effect.
jagrut: It was your comments that led me down the correct path in the end. When I looked in the C:\Program Files\Microsoft Visual Studio 10.0\Visual Studio Tools for Office folder there were NO sub folders. So, with nothing to loose I reran the VS2010 install and lo and behold the 'Microsoft Office Developer tools' were not selected. I selected the missing features and it all works now.
I can only think when I installed VS2010 I was being frugal as I was trying to get everything installed on a 40GB SSD drive on my laptop and didn't think I needed this feature.
Thanks all for your help.
James: As your solution suggested and by my previous searches, the interops are installed with Office or VS. My searches concluded that I re-install any missing features from the Office Install disk. I did this but was not happy with the options offered. There was no obvious check boxes to select or deselect features and the interopt options 'appeared' to have been installed. I still went through the process but it had no effect.
jagrut: It was your comments that led me down the correct path in the end. When I looked in the C:\Program Files\Microsoft Visual Studio 10.0\Visual Studio Tools for Office folder there were NO sub folders. So, with nothing to loose I reran the VS2010 install and lo and behold the 'Microsoft Office Developer tools' were not selected. I selected the missing features and it all works now.
I can only think when I installed VS2010 I was being frugal as I was trying to get everything installed on a 40GB SSD drive on my laptop and didn't think I needed this feature.
Thanks all for your help.
Add Reference > Com Tab