c# - 程序集引用之间的差异

标签 c# .net visual-studio-2010 visual-studio-2012

在某些机器上,在 csproj 中添加对程序集的引用后会生成下一个标记。

<Reference Include="Microsoft.Expression.Interactions">
  <HintPath>..\Libs.SL\Blend\Microsoft.Expression.Interactions.dll</HintPath>
</Reference>

但是在一些机器上生成了版本、文化、 token 和处理器架构的引用:

 <Reference Include="Microsoft.Expression.Interactions, Version=5.0.5.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
  <SpecificVersion>False</SpecificVersion>
  <HintPath>..\Libs.SL\Blend\Microsoft.Expression.Interactions.dll</HintPath>
</Reference>

这是为什么?

最佳答案

摘自msdn:

Processor architecture is added to the assembly identity in the .NET Framework version 2.0, to allow processor-specific versions of assemblies. You can create versions of an assembly whose identity differs only by processor architecture, for example 32-bit and 64-bit processor-specific versions. Processor architecture is not required for strong names. For more information, see AssemblyNameProcessorArchitecture. In this example, the fully qualified name indicates that the myTypes assembly has a strong name with a public key token, has the culture value for US English, and has a version number of 1.0.1234.0. Its processor architecture is "msil", which means that it will be just-in-time (JIT)-compiled to 32-bit code or 64-bit code depending on the operating system and processor.

Code that requests types in an assembly must use a fully qualified assembly name. This is called fully qualified binding. Partial binding, which specifies only an assembly name, is not permitted when referencing assemblies in the .NET Framework.

All assembly references to assemblies that make up the .NET Framework also must contain a fully qualified name of the assembly. For example, to reference the System.Data .NET Framework assembly for version 1.0 would include:

在源代码中查看更多内容:

http://msdn.microsoft.com/en-us/library/k8xx4k69.aspx

关于c# - 程序集引用之间的差异,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13703868/

相关文章:

c# - 不同日期列表

c# - WCF - 想知道请求队列

c# - 为什么要使用 Func<string> 而不仅仅是字符串?

javascript - jquery 和 asp.net 文本区域

c# - 在运行时打印 EntityFramework 版本

c# - Azure函数返回已弃用的API header

c# - 在 C# 中,如何使用十六进制值创建 System.Drawing.Color 对象?

c# - 确定字符串后删除字符串

c# - 如何使用或不使用导航属性进行 Linq 多对多连接

c++ - 如何编译以便文件名/行号可用于错误报告工具?