我可以控制分配到互操作程序集的版本号? [英] Can I control version number assigned to interop assembly?

查看:138
本文介绍了我可以控制分配到互操作程序集的版本号?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个使用一个本地C ++ COM对象C#程序。 Visual Studio中生成一个互操作程序集与包装在COM对象的类型。每次我重新编译的C#程序互操作程序集有1.0.0.0版本。

I have a C# program that uses a native C++ COM object. Visual Studio generates an interop assembly with wrappers for the types in the COM object. Each time I recompile the C# program interop assembly has version 1.0.0.0.

这是坏的安装程序 - 有时我们扩展了COM对象接口(在一些界面的末尾添加新的方法),这样的互操作程序集必须改变。当安装程序尝试更新它认为,互操作程序集并没有改变(因为它仍然有1.0.0.0版本)的现有安装,并跳过更新它,程序不能正常工作。

This is bad for the installer - sometimes we extend the COM object interfaces (add new methods at the end of some interface) so the interop assembly has to be changed. when the installer tries to update an existing installation it thinks that the interop assembly hasn't changed (since it still has version 1.0.0.0) and skips updating it and the program doesn't work.

如何控制分配到互操作程序集的版本号?

How can I control the version number assigned to the interop assembly?

推荐答案

这是一个小会儿,所以我可能会记住不正确的是如何工作的,但我认为你可能可以做你想做,如果你使用的是什么的 TLBIMP 而不是VS创建的包装。

It's been a little while so I might be remembering incorrectly how this works but I think that you might be able to do what you want if you use Tlbimp rather than having VS create the wrappers.

也许你可以做到这一点使用 asmversion 参数,否则,如果你给它使用强名称有可能的密钥文件参数。

Possibly you could do it using the asmversion parameter and otherwise it might be possible if you give it a strong name using the keyfile parameter.

这篇关于我可以控制分配到互操作程序集的版本号?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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