Solved

C# error " The type or namespace name 'Office' does not exist in the namespace 'Microsoft' (are you missing an assembly reference?)"

Posted on 2011-02-14
5
1,037 Views
Last Modified: 2012-05-11
I get the error message

 The type or namespace name 'Office' does not exist in the namespace 'Microsoft' (are you missing an assembly reference?)

when I attempt to run the C# code from my page.  I have already included the reference to the Micorosft.Office.Excel namespace in my code, which is why I am confused.
0
Comment
Question by:melli111
  • 3
5 Comments
 
LVL 23

Expert Comment

by:Rajkumar Gs
ID: 34889600
It could be due to lack of proper assembly. You may have older version.
Try download from here and refer it in your project
http://www.microsoft.com/downloads/en/details.aspx?FamilyId=C41BD61E-3060-4F71-A6B4-01FEBA508E52&displaylang=en
0
 
LVL 15

Author Comment

by:melli111
ID: 34890246
I am using Office 2007, with the .xlsx extension.  This link appears to be for Office 2002, and the file I am using is for Office 2007.  Will thi slink be suitable for this case?
0
 
LVL 23

Expert Comment

by:Rajkumar Gs
ID: 34890306

Check in your GAC for the exact assembly name?

I assume, it would be
Micorosft.Interop.Office.Excel
instead of
Micorosft.Office.Excel

Try
0
 
LVL 23

Expert Comment

by:Rajkumar Gs
ID: 34890332
In your namespace also check with the help of intellisense for
Microsoft.
0
 
LVL 33

Accepted Solution

by:
Todd Gerbert earned 500 total points
ID: 34890383
Have you added the appropriate Microsoft.Office.Interop... references to your project?
Untitled.png
0

Featured Post

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

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

Suggested Solutions

Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my asp.net applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…

832 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