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?
我试图让ASP.NET 5网站使用visual studio 2015预览版,我想在本地文件系统中将dll添加到ASP.NET 5项目中。但我找不到这个选项,是否不再可能添加本地DLL?如果是,为什么?
2 个解决方案
#1
2
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)
如果你有项目代码,你可以将Foo.csproj作为参考添加到Bar.xproj但不能直接添加,请参阅下面的说明。它可以在Beta8中不上传软件包的情况下完成,但它并不简单。如果你只有Foo.dll,这里有一个提示:Bin语法(包装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
去太Foo.csproj文件夹,输入:dnv wrap Foo.csproj。
你现在应该生成一些文件,对我来说它是Foo / wrap / Foo / project.json。转到Visual Studio中的解决方案,添加 - >现有项目 - > project.json。
现在你有了更多的文件,包括Visual Studio解决方案中提供的Foo.xproj,但它没有构建。
在Foo目录中打开cmd并执行dnv restore。
4)完成后没有错误,可以构建Foo.xproj,现在可以转到Bar.xproj并添加Foo.xproj作为参考。
在Bar目录中打开cmd并执行dnv restore。
您现在可以构建Bar.xproj
I really hope that this will be easier in final version.
我真的希望在最终版本中这会更容易。
#2
3
You cannot add direct reference anymore, you would have to create your own nuget package containing it.
您不能再添加直接引用,您必须创建自己的包含它的nuget包。
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.
至于为什么,使用nuget管理依赖关系,在任何地方下载源代码都非常容易,并且只需一个命令(kpm restore)就可以下载所有必需的nuget包。
#1
2
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)
如果你有项目代码,你可以将Foo.csproj作为参考添加到Bar.xproj但不能直接添加,请参阅下面的说明。它可以在Beta8中不上传软件包的情况下完成,但它并不简单。如果你只有Foo.dll,这里有一个提示:Bin语法(包装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
去太Foo.csproj文件夹,输入:dnv wrap Foo.csproj。
你现在应该生成一些文件,对我来说它是Foo / wrap / Foo / project.json。转到Visual Studio中的解决方案,添加 - >现有项目 - > project.json。
现在你有了更多的文件,包括Visual Studio解决方案中提供的Foo.xproj,但它没有构建。
在Foo目录中打开cmd并执行dnv restore。
4)完成后没有错误,可以构建Foo.xproj,现在可以转到Bar.xproj并添加Foo.xproj作为参考。
在Bar目录中打开cmd并执行dnv restore。
您现在可以构建Bar.xproj
I really hope that this will be easier in final version.
我真的希望在最终版本中这会更容易。
#2
3
You cannot add direct reference anymore, you would have to create your own nuget package containing it.
您不能再添加直接引用,您必须创建自己的包含它的nuget包。
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.
至于为什么,使用nuget管理依赖关系,在任何地方下载源代码都非常容易,并且只需一个命令(kpm restore)就可以下载所有必需的nuget包。