[英]Project reference properties - Version number
I have a Visual Studio project that references an assembly that I also created. 我有一个Visual Studio项目,该项目引用一个我也创建的程序集。 Below is a screen shot of the properties of my assembly reference in the project.
下面是该项目中我的装配引用的属性的屏幕截图。 When I update my assembly version to
1.1.0.0
, my project fails, and I am thinking this property is the issue. 当我将程序集版本更新为
1.1.0.0
,我的项目失败,并且我认为此属性是问题。
Since the Version
attribute says 1.0.0.0
, does this mean it will always look for my assembly that has a version of 1.0.0.0
? 由于
Version
属性表示1.0.0.0
,这是否意味着它将始终寻找版本为1.0.0.0
? And incrementing my version to 1.1.0.0
will cause my project to not see the assembly at all? 而将我的版本增加到
1.1.0.0
会导致我的项目根本看不到程序集吗?
You have 2 versions of strongly named assembly. 您有2个版本的强命名程序集。 It is by design behavior for other projects that where compiled against one version of such assembly to fail to load assembly with different version.
根据设计行为,针对其他版本的程序集进行编译的其他项目无法加载具有不同版本的程序集。 The reasoning is that version change denotes API change.
原因是版本更改表示API更改。 Otherwise it would be in-place update with the same version - so older code may not be able to function correctly with newer DLL.
否则,它将使用相同版本进行就地更新-因此,较旧的代码可能无法与较新的DLL一起正常运行。
Options: 选项:
Side note: depending on if the assembly in question is for internal (you control all projects using the assembly) or external consumption you may need to do more work on ensuring backward compatibility and proper deprecation policy. 旁注:根据所讨论的程序集是用于内部(使用该程序集控制所有项目)还是用于外部消耗,您可能需要做更多的工作来确保向后兼容和适当的弃用策略。
Publisher policy sample: from article linked above: 发布者政策示例:摘自上面链接的文章:
<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="myAssembly"
publicKeyToken="32ab4ba45e0a69a1"
culture="en-us" />
<!-- Redirecting to version 2.0.0.0 of the assembly. -->
<bindingRedirect oldVersion="1.0.0.0"
newVersion="2.0.0.0"/>
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.