So I've installed Asp.net vNext onto my Linux box and have been playing around with it. I have everything set up and can build and run mvc applications. I'm building a console application and need to reference an assembly that doesn't exist in NuGet. I want to add a reference to Mono.Data.SqliteClient to my project.json. I know the path to the assembly /usr/local/lib/mono/4.5/Mono.Data.Sqlite.dll.

How do I add the reference to the dll? My project.json file currently looks like this:

 {
     "dependencies": {
       "System.Console": "4.0.0.0",
       "Dapper":"1.27",
       "Mono.Data.Sqlite":""
     },
     "configurations": {
       "net45": {},
       "k10": {}
     }
 }
有帮助吗?

解决方案

I found the answer on a forum...

In a nutshell, you can only reference your dlls if they are inside a nuget package... ( I hope this will be improved. It is a hassle IMO. )

The long story :

Ok, after a lot of fannying about, it seems that the way to do this is to create a nuget package using the DLL (i'll use Quartz version 2.2.4.400 as an example).

use http://docs.nuget.org/docs/creating-packages/using-a-gui-to-build-packages to build it. Drag and drop Quartz.dll into the right hand side (nb. it does need to be placed in the lib directory). File -> save as... save it in the following location:

projectRoot\packages\Quartz.2.2.4.400\Quartz.2.2.4.400.nupkg

With the dll in the following:

projectRoot\packages\Quartz.2.2.4.400\lib\Quartz.dll

nb. placing the DLL outside of the lib directory will compile alright, but won't work with intellisense. If you are compiling with a specific version, then i'd put it in a net45, net451 or k10 folder; as i'm not, I didn't bother. my project.json then looks like:

{

    "dependencies": {
        "Quartz" : "2.2.4.400"
    },

    "configurations" : {

        "k10" : { 

            "dependencies": {

                "System.Console": "4.0.0.0"
            }

        }

    }

}
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top