?
Solved

Primary Interop Assembly Missing

Posted on 2009-05-06
9
Medium Priority
?
1,745 Views
Last Modified: 2013-11-26
This is related to this question, which I am assisting with:

http://www.experts-exchange.com/Microsoft/Development/MS-SQL-Server/SSIS/Q_24357093.html

Basically, I cannot find the

Microsoft.Office.Interop.Excel

assembly in my .Net references window. (under Project/Add Reference). I can't find it in Visual Studio, or the SSIS .Net script editor

I have found a file called

Microsoft.Office.Interop.Excel

In the C:\Windows\assembly folder.

I have also installed the Redistributable Primary Interop Assemblies from here:

http://www.microsoft.com/downloads/details.aspx?familyid=59DAEBAA-BED4-4282-A28C-B864D8BFA513&displaylang=en


I am a vb 6 developer, not a .Net developer. I basically want to control Excel through the Excel object model and I do not want to use the COM objects directly.


My understanding is that I need to reference this assembly to do this.


Just another question: Is this statement:

Imports Microsoft.Office.Interop.Excel

equivalent to adding the reference to the project from the menu? I first picked up on this issue when the Import statement said it couldn't find the reference. Do I need to do both or would the Imports statement alone be sufficient normally?

I am using Visual Studio 2005 8.0.50727.867
I have Microsoft .Net Framework 2.0.50727 installed

I assume when I get this assembly to appear in VS, it will appear in the SSIS editor (which is my real goal)
VSVersion.jpg
0
Comment
Question by:nmcdermaid
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 7
9 Comments
 
LVL 47

Accepted Solution

by:
Wayne Taylor (webtubbs) earned 1500 total points
ID: 24322931
To add a reference, you will need to look under the "COM" tab of the references dialog. It will be called "Microsoft Excel XX.0 Object Library", where "XX" is the version of Excel.

A reference is required before it can be "Imported". The Imports keyword allows a namespace to be accessed directly, which will mean that you can declare objects like this....

    Dim xlApp As Application

...instead of like this....

    Dim xlApp As Microsoft.Office.Interop.Excel.Application

A side note - when I import Excel, I use this construct....

    Imports Excel = Microsoft.Office.Interop.Excel

...which allows me to declare objects in such a way that I can easily see what namespace they are from....

    Dim xlApp As Excel.Application

Wayne
0
 
LVL 30

Author Comment

by:nmcdermaid
ID: 24331400
Only one problem: the SSIS visual studio editor does not have a COM tab it only has a .Net tab. I'm not sure why this is.
I see that .Net has the CreateObject statement. That would probably allow me to get around not having a 'COM' tab.
 
So if I understand correctly, the Imports keyword is a way of making a particular namespace 'pre-selected' in the editor, kind of similiar to 'With' in VB6?. You always need to add the reference under the menu, the imports is a just a way of making your code neat and making the namespace 'pre existing'?
 
0
 
LVL 30

Author Comment

by:nmcdermaid
ID: 24331417
Forgot to add screenshot...
ReferencesInSSIS.jpg
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 26

Expert Comment

by:Anurag Thakur
ID: 24336584
i see u r using VS 2005 professional, its surprising why are u not getting the tabs that we normally get
what kind of project are you using please explain it

here are a few samples hot to automate excel
http://support.microsoft.com/kb/302096
http://www.codeproject.com/KB/office/package.aspx
0
 
LVL 30

Author Comment

by:nmcdermaid
ID: 24341910
Sorry I didn't make it very clear. The purpose of this is to automate Excel from SQL Server Integration Services (SSIS). SSIS has a 'script' task which lets you write .Net script. It seems it only lets you reference .Net assemblies though.
I have plenty of experience automating Excel through VB6 and COM but none through .Net and Assemblies. It looks like I may need to use CreateObject to instantiate the various COM objects.
 
0
 
LVL 30

Author Comment

by:nmcdermaid
ID: 24372788
I've used CreateObject but I needed to tick 'Option Strict On by default' to enable late binding.
Can someone clarify: even though I have installed the assembly, and can see the assembly in C:\Windows\Assembly, why can't I see it in the .Net references tab?
0
 
LVL 30

Author Comment

by:nmcdermaid
ID: 24542973
Can anyone explain that?
0
 
LVL 30

Author Closing Comment

by:nmcdermaid
ID: 31578849
You've added to my .Net knowledge although the primary question wasn't answered. Thanks for your help anyway.
0
 
LVL 30

Author Comment

by:nmcdermaid
ID: 25020253
I've found this information:
The .NET tab of the Add Reference dialog box in Microsoft Visual Studio for Applications lists the managed assemblies found in the %windir%\Microsoft.NET\Framework\v2.0.xxxxx folder. Therefore, by default, this list is largely limited to assemblies from the Microsoft .NET Framework class library. The contents of the list are determined exclusively by file location and not by installation in the global assembly cache (GAC) or by other assembly attributes or properties. Therefore, a copy of any assembly that you want to reference must be present in the specified folder. The Add Reference dialog box in VSA does not include the Browse button that is present in Microsoft Visual Studio for locating and referencing managed assemblies in other folders, and does not include the COM tab for referencing COM components.
at this site:
http://msdn.microsoft.com/en-us/library/ms136033(SQL.90).aspx
 This explains my issue. Basically I needed to copy the Microsoft.Office.Interop.Excel
 file into %windir%\Microsoft.NET\Framework\v2.0.xxxxx folder
I have not tested this but I'm pretty sure that was my issue.
0

Featured Post

More Than Just A Video Library

Train for your certification. Learn the latest DevOps tools. Grow your skillset to do better work.

At Linux Academy, we release new training modules every week so you'll always be up to date on the latest tech.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
Suggested Courses

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question