VS2015的类库引用添加 [英] VS2015 add reference for Class Library

查看:5145
本文介绍了VS2015的类库引用添加的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在VS2015创建了一个项目,结构如下:

I have created a project in VS2015, structure as below:


  • BookStore.ClassLibrary1 =>类库(包)

  • BookStore.ClassLibrary2 =>类库

  • BookStore.Web => MVC5

在BookStore.Web,我可以引用的 BookStore.ClassLibrary2 ,但不能引用 BookStore.ClassLibrary1

In BookStore.Web, I can reference BookStore.ClassLibrary2, but fail to reference BookStore.ClassLibrary1.

它显示一个错误一提到ClassLibrary1的不能添加。

我的问题是如何引用VS2015类库(包)?太谢谢你了!

My question is how to reference a Class Library (Package) in VS2015? Thank you so much!

推荐答案

看起来你ClassLibrary1的项目是一个类库包,而不是一个类库项目。类库包用于创建的NuGet包,可以针对任何平台。

Looks like your ClassLibrary1 project is a Class Library Package, not a class library project. Class Library Package is used to create Nuget packages that can target any platform.

有一些ASP.NET 5类库项目(.kproj)在类库项目的收益(.csproj的):

There are a number of benefits of ASP.NET 5 Class Library projects (.kproj) over Class Library projects (.csproj):

ASP.NET 5类库轻松支持交叉编译项目到多个目标,如aspnet50,aspnetcore50,net45,以及其他各种便携式类库的变化。这包括丰富的Visual Studio支持智能感知,通知您该API可用于哪些目标。
的NuGet包自动创建的,这是做类库一种极为常见的事。
当谈到喜欢的东西自动刷新Solution Explorer中的文件系统的变化时获得更好的效率。试图合并在* .csproj的文件冲突的更改时,在源代码控制,冲突更少。
可被编译的跨平台(部分原因是因为它不依赖于MSBuild的)
您可以从* .kproj项目中引用一个* .csproj的项目(这只是更容易与Visual Studio 2015年的新的preVIEW很多),但它总是可以用一些手动步骤。

ASP.NET 5 class libraries easily support cross-compiling projects to multiple targets, such as aspnet50, aspnetcore50, net45, and various other portable class library variations. This includes rich Visual Studio support for Intellisense to notify you which APIs are available for which targets. NuGet packages are automatically created, which is an extremely common thing to do with class libraries. Better productivity when it comes to things like automatically refreshing Solution Explorer when the file system changes. Fewer conflicts in source control when trying to merge conflicting changes in the *.csproj file. Can be compiled cross-platform (in part because it doesn't depend on MSBuild) You can reference a *.csproj project from a *.kproj project (this was just made a lot easier with the new preview of Visual Studio 2015), but it was always possible with some manual steps.

为什么名字有ASP.NET的呢?

Why does the name have "ASP.NET" in it?

至于名字的推移,它是会很快得到解决的历史遗迹。新的项目类型是非常有用的远远超出了ASP.NET 5应用程序。预计在Visual Studio的未来preVIEW看到新的名称:

As far as the names goes, it's a relic of history that will soon be addressed. The new project type is useful far beyond ASP.NET 5 applications. Expect to see new names in a future preview of Visual Studio:

.NET控制台应用程序(跨平台)
.NET类库(跨平台)
与Visual Studio 2015年的发布RC你可以看到更新的项目模板名称:

.NET Console Application (Cross-platform) .NET Class Library (Cross-platform) With the release of Visual Studio 2015 RC you can see the updated project template names:

类库(包)
控制台应用程序(包)
这些使用project.json文件和.NET执行环境(DNX)来构建,运行和包(成的NuGet包)项目。

Class Library (Package) Console Application (Package) These use the project.json file and the .NET Execution Environment (DNX) to build, run, and package (into a NuGet package) the project.

这些项目模板继续在New Project对话框显示了网络节点下,但现在在主的Visual C#节点也显示为好。

These project templates continue to show up in the New Project dialog under the "Web" node, but now also show up in the main "Visual C#" node as well.

下面是一个很好的链接,因为你需要全球化志愿服务青年的新CLAS库没有建立一个DLL。 <一href=\"https://evolpin.word$p$pss.com/2015/01/25/vnext-and-class-libraries/\">https://evolpin.word$p$pss.com/2015/01/25/vnext-and-class-libraries/

Here is a good link as you need to referance a dll that the new clas library does not build. https://evolpin.wordpress.com/2015/01/25/vnext-and-class-libraries/

这篇关于VS2015的类库引用添加的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆