0

Since 3 days I've been trying every link I find on the issue, but always get the "CS0234: The type or namespace name 'Office' does not exist in the namespace 'Microsoft'" error. I need to convert Excel to PDF in c#.

This is my set-up:

  1. Windows Server 2012 R2
  2. Office Professional Plus 2010 (in Spanish! That should not be a problem though?!)
  3. Microsoft Office 2010 Primary Interop Assemblies
  4. Microsoft Visual Studio Express 2015 for Web

I won't see Microsoft.Office.Interop.Excel among the Assemblies under .NET; trying to find a way, I added the "Microsoft Excel 14.0 Object Library" to my project which made the "Microsoft.Office.Interop.Excel" reference at least appear in the list. But that dll points to C:\Windows\assembly\GAC_MSIL\Microsoft.Office.Interop.Excel\14.0.0.0__71e9bce111e9429c\Microsoft.Office.Interop.Excel.dll and seems to be useless as the error remains. I reinstalled everything several times and updated VS Express for Web from 2013 to 2015.

I read somewhere (Can I still use Microsoft.Office.Interop assemblies with office 2013?) that PIAs are considered a historical artifact and that one can do without. That was only more confusing and didn't help.

Community
  • 1
  • 1
Barnabeck
  • 459
  • 1
  • 6
  • 26
  • can you find the COM object for Excel (in the COM tab)? – Val Nov 11 '15 at 13:53
  • Yes, I added it from the COM tab – Barnabeck Nov 11 '15 at 14:13
  • and how are you instantiating the excel app's class? – Val Nov 11 '15 at 14:26
  • I haven't even started to do that, as the error shows up as soon as I add the namespace. I'm not using the code behind structure and embed the c# code in the script tag within my aspx page and importing the namespace like <%@ Import Namespace="Microsoft.Office.Interop.Excel" %> – Barnabeck Nov 11 '15 at 14:49
  • Solved. Ok, I learned that for some reason the Microsoft.Office.Interop.Excel resource CAN NOT be embedded! Once placed in code behind the page executes without a problem! – Barnabeck Nov 12 '15 at 09:12

0 Answers0