I am trying to make an ASP.NET 5 site use visual studio 2015 preview, and i want to add dll at local file system to the ASP.NET 5 project. But i can't find this option, Is it no longer possible to add local dll? If yes, why?
Asked
Active
Viewed 5,062 times
9

Jeffrey Zhang
- 428
- 4
- 15
2 Answers
4
You cannot add direct reference anymore, you would have to create your own nuget package containing it.
See: http://forums.asp.net/t/2002302.aspx?Adding+a+non+nuget+reference+to+a+vNext+project
As for the why, it is really easier to manage dependencies with nuget, download your sources anywhere, and with a single command (kpm restore) all nuget packages necessary will be downloaded.

wbuch
- 159
- 4
-
2@wbuch What about private DLLs? and suppose my dll are in development mode then how to manage because if all time bug fix and need to publish on nuget or is there any way to do that, i means build and automatically publish on nuget? – Vinit Patel Jun 05 '15 at 11:36
-
@VinitPatel You can create a private nuget package feed: see https://docs.nuget.org/create/hosting-your-own-nuget-feeds. Then you can publish on nuget.org (if you need to) when you are ready. – wbuch Jun 05 '15 at 13:04
-
@wbuch so by this local nuget package my dll are not upload on nuget and directly add to my project? and if i have two class library and i am using their reference, now if i update any class library then i need to again generate nuget package and again update my project reference? – Vinit Patel Jun 05 '15 at 13:08
-
Yes basically. Maybe there are simpler ways, i am not an expert on the subject, but as far as i know, this is the intended workflow. The benefit become obvious with bigger projects. – wbuch Jun 05 '15 at 13:12
3
If you have project code than you can add Foo.csproj to Bar.xproj as reference but not directly, see instructions below. It can be done without uploading packages in Beta8 but it is not simple as it should be. If you only have Foo.dll there is one hint here: Bin syntax (wrapping a dll)
- Go too Foo.csproj folder, type:
dnv wrap Foo.csproj
. - You should now have some files generated, for me it was
Foo/wrap/Foo/project.json
. Go to your solution in Visual Studio,Add -> Existing project -> project.json
. - Now you have some more files, including
Foo.xproj
which is available in Visual Studio solution, but it does not build. - Open cmd in Foo dir and execute
dnv restore
. - After 4) completes with no error and Foo.xproj can be built you can now go to Bar.xproj and add Foo.xproj as reference.
- Open cmd in Bar directory and execute
dnv restore
. - You can now build Bar.xproj
I really hope that this will be easier in final version.

watbywbarif
- 6,487
- 8
- 50
- 64
-
The project.json documentation has moved [here](https://learn.microsoft.com/en-us/dotnet/articles/core/tools/project-json#frameworks) -- scroll down a bit to see the bin syntax. – McGuireV10 Jul 15 '16 at 17:48
-