Search code examples
c#asp.netdnx

Understanding the new DNX


I'm looking into DNX (ASP.NET) and I'm facing a couple of issues with this. Under a project, in the node "References" you now see ".NET Framework 4.5.1" and ".NET Platform 5.4".

Now, I'm working on an application which is being hosted on Mongo and when installing that through Nuget, the reference only gets added to .NET Framework 4.5.1

When I'm building my application, I see a lot of errors regarding MongoDB namespace not found, despite they are colored and useable in the source code (I dohave intellisense).

Anyone who can explain me what's wrong?


Solution

  • That is because your code is built both for the "classical CLR" and for .NET core (this is the default in file->new Project when you created the project in Visual Studio).

    As it looks the MongoDB nuget package is only available for the "classical CLR", so your code cannot be built for the core CLR. One option is to drop the CoreCLR support: you can do this by removing that from the "frameworks" part in the project.json file.

    Now I don't know anything about the MongoDb nuget package... maybe there is a CoreCLR version... if this is the case then you need to add that dependency for CoreCLR (Maybe someone knows whether there is support for CoreCLR at all and can extend my answer..)