我在研究Visual Studio 2015的新功能时,发现了很多共享项目,但我不明白使用类库或可移植类库有什么不同.有人能解释一下吗?
Edit:共享项目是Visual Studio 2015中的一项新功能,与可移植类库不同.我知道什么是可移植类库.我想了解的是,共享项目与类库有何不同.请参阅下面的链接.
我在研究Visual Studio 2015的新功能时,发现了很多共享项目,但我不明白使用类库或可移植类库有什么不同.有人能解释一下吗?
Edit:共享项目是Visual Studio 2015中的一项新功能,与可移植类库不同.我知道什么是可移植类库.我想了解的是,共享项目与类库有何不同.请参阅下面的链接.
共享项目和类库之间的不同之处在于,后者是编译的,重用的单位是程序集.
而对于前者,重用单元是源代码,并且共享代码被合并到引用共享项目的每个程序集中.
当您想要创建针对specific个平台但仍有应该共享的代码的单独程序集时,这会很有用.
另见here:
共享项目引用显示在解决方案资源管理器的"引用" node 下,但共享项目中的代码和资源被视为链接到主项目的文件.
In previous versions of Visual Studio1, you could share source code between projects by Add -> Existing Item and then choosing to Link. But this was kind of clunky and each separate source file had to be selected individually. With the move to supporting multiple disparate platforms (iOS, Android, etc), they decided to make it easier to share source between projects by adding the concept of Shared Projects.
1这个问题和我的回答(到目前为止)表明,共享项目是Visual Studio 2015的一项新功能.事实上,他们在Visual Studio 2013 Update 2年首次亮相