我们如何在vs2008中更改DLL的版本 [英] How can we change the version of DLL in vs2008

查看:80
本文介绍了我们如何在vs2008中更改DLL的版本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


我遇到一个问题,我试图将在vs2005中创建的dll加载到vs2008中.我在版本中遇到问题.编译器正在寻找版本1.0.0.0,但我传递的版本是1.0.1578.31812,这导致了问题.请帮助我如何更改dll的版本.
谢谢,
Kiran

Hi,
I got an issue where i am trying to load a dll which is created in vs2005 into vs2008.I am getting an issue in versions.The compiler looks for version 1.0.0.0 but the version i am passing is 1.0.1578.31812 which is causing an issue.Please help me how to change the version of dll.
Thanks,
Kiran

推荐答案

您需要更新项目的AssemblyInfo.cs文件中的版本信息.您也可以只将对程序集的引用更改为特定版本".这些都可以解决您的问题.
You need to update the version information in the AssemblyInfo.cs file of the project. You can also just change the reference to the assembly to not be "Specific Version". Either of these would solve your problem.


我希望您有引用程序集的源代码.您有引用程序集的源代码吗?如果两者兼有,有更好的方法.

将两个项目放在一个程序集中.使用添加引用"(但按项目)引用另一个项目.在带参考的窗口中使用项目"选项卡.这样,在您构建时,引用程序集中的所需版本与引用程序集的实际版本之间的匹配将自动更新.当您更改程序集的任何版本时,不需要匹配源代码中已更新的版本-一切将在构建过程中自动完成.但是,在运行时,将保持对具体版本的严格依赖.因此,请勿使用非特定版本.

附带建议:请务必在程序集上签名.从一开始就很容易做到,并且是非常有价值的功能.我没有时间解释原因.了解强名.

—SA
I hope you have source code for you referenced assembly. Do you have the source code of referencing assembly? If you have both, there are a better way.

Put both projects in a single assembly. Reference one project in another one using "Add references" but by project. Use "Projects" tab in the windows with references list. In this way, the match between the required version in the referenced assembly and actually version of referencing assembly will be updated automatically as you build. When you change any version of the assembly, not matching updated in source code is needed — everything will be automatically done during build. During run-time, however, strict dependency on concrete version will be maintained. Therefore, do not use non-specific version.

A side advice: always sign your assemblies. It''s easy to do it in the very beginning and is a very valuable feature. I don''t have time to explain why. Read about strong names.

—SA


这篇关于我们如何在vs2008中更改DLL的版本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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