0

I have some C# code which was originally written in Visual Studio.

I am now trying to make this code run in a Mac, using the Xamarin Studio.

I get multiple errors, that have to do with the references:

For example, the original code uses a library which is called "ClosedXML".

I get an error "The type or namespace nameClosedXML' could not be found. Are you missing an assembly reference?"`

I get such errors on many occasions, for different libraries.

Any way to solve this? Thanks in advance

adrCoder
  • 3,145
  • 4
  • 31
  • 56
  • 1
    Hey! Have you tried re-adding the package using `NuGet`? I know that I ran into a similar issue with Xamarin, but adding the packages using `Add NuGet Packages` under the `Project` menu resolved the issues. – Leejay Schmidt Dec 21 '15 at 17:37
  • As Leejay said, assuming you added ClosedXML via nuget in VS, restore it and you should be fine. If it is not already added via the Nuget package manager in XS, double click on `Packages` in the Solution tree and search/add ClosedXML... works fine for the one XS project that I use it for... FYI: Excel 15.x for Mac does report the `.xlsx` files produced as 'damaged' but it auto-repairs them fine... – SushiHangover Dec 21 '15 at 17:46
  • It works for ClosedXML but not for the following : `Microsoft.Office.Interop.Excel;` . Can you help me with this error ? – adrCoder Dec 21 '15 at 17:55
  • It looks like you may have to use `Excel-DB - Primary Interop Assemblies` from `NuGet` for that. – Leejay Schmidt Dec 21 '15 at 18:07
  • Excel-DB does not exist (or I can not find it). I added a similar one that has Primary Interop Assemblies on its name, then I get a bunch of errors "Cannot implicitly convert type `object' to `Microsoft.Office.Interop.Excel.Worksheet' – adrCoder Dec 21 '15 at 19:07
  • If you're on Mac, I assume you're using the Mono framework? If so, sorry, ClosedXML doesn't run on Mono yet, due to bugs in Mono. – Francois Botha Dec 11 '16 at 08:05

1 Answers1

0

For each of the The type or namespace name xxx could not be found error, you have to reference the associated assemblies.

For example, you have to add ClosedXML.dll to resolve ClosedXML namespace. It can be done via Nuget -

PM> Install-Package ClosedXML

Or directly downloading and referencing the DLL from here

Atanu Roy
  • 1,384
  • 2
  • 17
  • 29