[英]How to add a reference of a .NET class library to a vNext Project
I have an ASP.Net 5 project in which I wish to reference a number of .Net class libraries. 我有一个ASP.Net 5项目,我希望在其中引用一些.Net类库。 However, I've had a lot of issues doing this successfully.
但是,我成功地做了很多这样的问题。
My project directory looks something like this: 我的项目目录看起来像这样:
WebProject
NetLibrary1
NetLibrary2
NetLibrary3
src
Web Project Code
wrap
DevExpress.Data.v14.1
project.json
.
.
NetLibrary1
project.json
The wrap folder contains a folder for each DLL that is referenced in the web project, and inside each one of those folders is a project.json file that I guess "wraps" the DLL into a faked Nuget package for the vNext project to consume. wrap文件夹包含web项目中引用的每个DLL的文件夹,并且每个文件夹中都有一个project.json文件,我猜这个文件“包装”到一个伪造的Nuget包中供vNext项目使用。
My problem is that I seem unable to successfully wrap 2 of my NetLibrary projects so that my vNext project can reference them. 我的问题是我似乎无法成功包装我的两个NetLibrary项目,以便我的vNext项目可以引用它们。 I attempt to add the references by right-clicking and it puts the Project names in my Web's project.json file in the following manner:
我尝试通过右键单击添加引用,并按以下方式将项目名称放在Web的project.json文件中:
"frameworks": {
"dnx451": {
"dependencies": {
"NetLibrary1": "1.0.0-*",
"NetLibrary2": "1.0.0-*"
}
}
}
But then when it tries to restore the packages it says: "Unable to locate NetLibrary1 >= 1.0.0-*". 但是当它试图恢复包时,它说:“无法找到NetLibrary1> = 1.0.0- *”。
I'm incredibly frustrated having to deal with bleeding-edge technology like this and I'm looking for a clear method to fix my reference woes. 我非常沮丧地不得不处理像这样的尖端技术,我正在寻找一种明确的方法来解决我的参考问题。
Thanks for any responses! 谢谢你的回复!
You want to add old class library Foo.csproj to Bar.xproj as reference. 您希望将旧类库Foo.csproj添加到Bar.xproj作为参考。 It can be done without uploading packages in Beta8 but it is not simple as it should be.
它可以在不上传Beta8的软件包的情况下完成,但它并不简单。
dnv wrap Foo.csproj
. dnv wrap Foo.csproj
。 Foo/wrap/Foo/project.json
. Foo/wrap/Foo/project.json
。 Go to your solution in Visual Studio, Add -> Existing project -> project.json
. Add -> Existing project -> project.json
。 Foo.xproj
which is available in Visual Studio solution, but it does not build. Foo.xproj
,但它没有构建。 dnv restore
. dnv restore
。 dnv restore
. dnv restore
。 I really hope that this will be easier in final version. 我真的希望在最终版本中这会更容易。
I found the answer to my question in JimmyD's response in this link 我在JimmyD的回答中找到了我的问题的答案
Issue Adding Reference to Class library project 问题添加对类库项目的引用
The actual marked response in that question wasn't working but fortunately browsing to the project DLL in the actual file structure did. 该问题中实际标记的响应不起作用,但幸运的是在实际文件结构中浏览到项目DLL。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.