0

I'm having a hard time installing GemBox.Spreadsheet package in my .NET app. That's my first time using .NET (C#)., i have a Node.JS background, so I don't understand the problem.

I already installed with dnu install GemBox.Spreadsheet and everything looks fine, but i still see the error 'The type or namespace name 'GemBox' could not be found'

UPDATE -

I found this question and i tried to reproduce, but didn't work.

That's my project.json:

{
  "version": "1.0.0-*",
  "compilationOptions": {
    "emitEntryPoint": true
  },
  "dependencies": {
    "NETStandard.Library": "1.0.0-rc2-23811",
    "GemBox.Spreadsheet": "39.3.30.1153"
  },
  "frameworks": {
    "dnxcore50": {
        "GemBox.Spreadsheet": "39.3.30.1153"
    }
  }
}

Thanks.

Community
  • 1
  • 1

2 Answers2

1

This package is not compatible with dnxcore50, it appears to only run on the Desktop .NET Framework.

You need to target a desktop framework in your project.json (keep in mind you won't be running on CoreCLR). You could change your framework to dnx451, for example.

what does dnxcore50 mean?

To fully answer this would take quite a while, but here's the gist.

You're using what's called a "project.json" type project for .NET. They're new, and they are in beta/preview.

Another component of this is Microsoft has several runtimes. There is the desktop framework, which is the .NET Framework that has existed from 2001, and there are many other .NET Frameworks. Another one, for example, is .NET Core. Core can run on operating systems other than Windows, but it doesn't have the same feature set as the Desktop .NET Framework. In your project.json file, you have dnxcore50 as the framework you support, which is .NET Core.

However, this nuget package you are trying to use does not support this framework. It only supports the desktop .NET Framework. You can change the framework your application uses by changing dnxcore50 to dnx451. This however, will mean your project can only run on the Desktop .NET Framework on Windows, and perhaps Mono on OS X.

vcsjones
  • 138,677
  • 31
  • 291
  • 286
  • @CodingGorilla it does appear to be on nuget here: https://www.nuget.org/packages/GemBox.Spreadsheet/. That's how I was able to inspect what TFMs it was compatible with. – vcsjones Apr 07 '16 at 18:29
  • Hei vcsjones, i'm a little lost, what dnxcore50 means? –  Apr 07 '16 at 18:30
  • @vcsjones You are correct, I kept reading that as "GameBox" for some reason and that's what I searched for. Sorry for the confusion! – CodingGorilla Apr 07 '16 at 18:30
  • @FátimaAlves You have a project.json, suggesting you're using ASP.NET 5 (normal/older C# projects would have a .csproj file instead). This targets the newer-fangled multiplatform .NET Core libraries rather than the "standard" .NET for desktop machines. However, the GemBox module does not run on the Core runtime. So go to your project's settings; that should allow you to choose tha target framework(s) - choose a desktop one (4.6 probably). – Zastai Apr 07 '16 at 18:35
  • HM.. i'm using OS X (Mono), this makes difference? –  Apr 07 '16 at 18:38
  • @FátimaAlves if you are using mono, I would try changing `dnxcore50` to `dnx451` and seeing if your project can still run. – vcsjones Apr 07 '16 at 18:40
  • I get it, but i think i can't use 451, cause i changed and now all my requires (using ....) isn't available: http://i.imgur.com/FKtwntz.png –  Apr 07 '16 at 18:46
0

Attempt the following:

In Solution Explorer, select the project. Later, on Project Menu, click Add Reference. After, add a new reference to the dll with GemBox.Spreadsheet name. It should be under .net tab.

Finally at the top in the namespace of your code, use:

using GemBox.Spreadsheet;
  • I'm using VS CODE (OS X), i don't have this menu option. I forgot to specify my OS, sorry. –  Apr 07 '16 at 18:35