Visual Studio中的参考程序集和公共程序集之间有什么区别
我一直在研究Visual Studio 2013中的Web性能测试插件的一些问题.当添加对必要dll的引用(例如Microsoft.VisualStudio.QualityTools.WebTestFramework.dll
)时,我注意到添加引用"中有多个用于同一dll的条目.窗户.在我的系统上,WebTestFramework有五个选择.
I have been investigating some issues with Web Performance Test Plugins in Visual Studio 2013. When adding references to the necessary dlls (e.g. Microsoft.VisualStudio.QualityTools.WebTestFramework.dll
) I noticed that there are multiple entries for the same dll available in the 'Add References' window. On my system I have five choices for WebTestFramework.
我看到的其中一些来自早期版本的Visual Studio,这些版本也安装在我的计算机上.但是,我发现其中有些是重复的,例如:
Some of these I see are from earlier versions of Visual Studio which are also installed on my machine. However, I see that some are duplicates, e.g.:
C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\ReferenceAssemblies\WebTestFramework.dll
C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\PublicAssemblies\WebTestFramework.dll
我已经比较了这两个文件的哈希值,它们是相同的.那么,为什么它们在我的VS 2013(v12.0)安装中出现两次?为什么同时存在"ReferenceAssemblies"和"PublicAssemblies"文件夹?
I've compared the hashes of these two files and they are identical. So, why are they present in my VS 2013 (v12.0) installation twice? Why is there both a 'ReferenceAssemblies' and a 'PublicAssemblies' folder?
好吧,理想情况下,实现程序集不会出现在列表中.但是对列表中出现的内容的控制不够细致,只能通过目录而不是单个程序集进行配置.另一个限制是,Microsoft经常被迫为程序集选择比期望的存储位置少的存储位置,以保持与VS早期版本的向后兼容性,以便它们不会破坏现有项目.测试框架在VS版本中发生了很大变化,花了一些时间才解决了所有怪癖.
Well, ideally the implementation assembly doesn't appear in the list. But the control over what appears in the list isn't fine-grained enough, it can only be configured by directory, not individual assemblies. A further constraint is that Microsoft is often forced to pick less than desirable storage locations for an assembly to maintain backwards compatibility with previous VS versions so they don't break existing projects. And the test frameworks have changed a great deal through the VS versions, took them a while to get all the quirks ironed out.
始终在提供参考组件时选择该参考组件.它们旨在使您免受这些快速变化的影响,并且通常有意不是实现程序集的副本.当您选择实现程序集时,它将使它起作用,但是您有冒险在下一个VS版本中破坏测试项目的风险. YMMV.
Always pick the reference assembly when one is offered. They are meant to isolate you from these rapid changes and often intentionally are not a copy of the implementation assembly. You'll get it to work when you pick the implementation assembly but you risk having your test project broken in the next VS version. YMMV.