设置VB.Net 2005应用程序的版本? (听起来很简单,不是吗?) [英] Set the version of a VB.Net 2005 application? (Sounds simple, doesn't it?)

查看:138
本文介绍了设置VB.Net 2005应用程序的版本? (听起来很简单,不是吗?)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

请原谅我使用旧版本的Visual Studio,但我继承了一个VB .NET 2005项目,需要制作一些mod并为我们的用户生成某种形式的分发文件。我是一个老的VB6程序员,我经历了大量的学习(使用代码项目示例 - 感谢GUYS!)来达到项目在IDE中构建和运行的程度。



现在是时候部署了,尽管将Assembly Information属性设置为Assembly Version 2.0.0。*和File Version 2.0.0.0,安装的版本仍然继续在程序和功能(以前称为添加/删除程序)中显示为版本1.5.2,并且应用程序不会替换旧版本,因此我必须手动删除它(这是我注意到版本问题的方式)。我已经搜索了我的所有解决方案文件中的任何1.5.2,并且都不存在。我已经尝试打开每个源文件并进行/删除单个更改以强制它们重新编译,但仍然没有幸福。我没有时间或精力尝试将项目导入VS的更新版本(2008或2010),所以我希望有人能指出我的修复方法,我整天都在努力弄清楚是什么在Google上搜索。



谢谢,任何帮助都非常感谢。



最基本的问候!



John

解决方案

可怕。这根本不是问题。程序集版本,文件版本和 - 奖金! - 产品版本由适当的属性定义,目标为 System.AttributeTargets.Assembly ,而不是其他任何内容。例如:

 [ assembly :AssemblyVersion(  20.0.0.0)] 
[ assembly :AssemblyFileVersion( 20.0.0.0)]
[ assembly :AssemblyInformationalVersion( 1.1.0.0)] / / 显示为产品版本



所有悲伤历史你的所有遗产都无关紧要。如果您的项目使用这三行编译任何文件,您的程序集将被编译为一个模块,其中程序集清单具有所述版本。通常,在Visual Studio的现代版本中,这些行放在文件 /Properties/AssemblyInfo.cs 中,但它根本没有特殊含义。只有这三个属性的应用才是重要的。



此外,*表示该版本的某些组件是由构建自动生成的,但我会使用它只在开发过程中;最终产品发布版本(我希望你将创建一个命令行构建脚本/批处理,否则它不是一个真正的开发周期:-))应该放置一些具体的固定版本值。



你得到了确切的食谱。祝你好运。







另一个额外的建议。



将项目迁移到Visual Studio支持的.NET版本。通常,这根本不是问题。



无需为使用.NET v.2.0道歉 - 这是一个相当不错的版本,使用泛型和匿名方法。使用它从来没有错。但是对于更高版本,你将拥有lambda表达式和类型推断等重要功能,这两者都非常方便,更多。



-SA


我的解决方案工作文件夹中有一个名为Install的文件夹,其中包含一个名为'ApplicationNameinstall.vbproj'的文件。尽管Visual Studio中的在文件中查找功能没有找到旧版本字符串,但使用十六进制编辑器查看它显示实际上它就在那里。



我认为这个文件是先前运行'Click Once'安装选项创建的。删除此文件夹中的这个和其他2个文件(autorun.inf和WiRunSQL.vbs)允许我重建一个包含正确版本的application.msi。


我会猜测一下



旧版本的MSI安装程序(使用WiX 3.5创建)有一个错误,不会更新VS2005中使用的版本号。



可能看看John的修正是否有效



阅读旧文章修复此处

http://stackoverflow.com/questions/114165/how-to-implement-wix-installer-upgrade [ ^ ]



除此之外,但更危险的是手动输入注册表项

 HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\ CurrentVersion\Uninstall 


Hi, please excuse me for working with an old version of Visual Studio, but I have inherited a VB .NET 2005 project, and needed to make some mods and produce some form of distribution files for our users. I am an old VB6 programmer, and I've gone through a ton of learning (using codeproject examples - THANKS GUYS!) to get to the point where the project builds and runs in the IDE.

Now it is time to deploy, and despite setting the Assembly Information properties to Assembly Version 2.0.0.* and File Version 2.0.0.0, the installed version continues to show up in 'Programs and Features' (formerly Add/Remove Programs) as Version 1.5.2, and the application will not replace an old version, so I have to manually remove it (which was how I noted the version issue). I have searched all my solution files for any occurrence of '1.5.2', and none exist. I've tried opening every source file and making/deleting a single change to force them to recompile, and still no happiness. I do not have the time or energy to try importing the project into a newer (2008 or 2010) version of VS, so I'm hoping someone here can point me toward a fix, which I've tried all day to figure out what to search on in Google.

Thanks, any help greatly appreciated.

Kindest Regards!

John

解决方案

Dreadful. This is not a problem at all. The assembly version, file version, and — bonus! — product version are defined by appropriate attributes with the target System.AttributeTargets.Assembly, and nothing else. For example:

[assembly: AssemblyVersion("20.0.0.0")]
[assembly: AssemblyFileVersion("20.0.0.0")]
[assembly: AssemblyInformationalVersion("1.1.0.0")] // shown as "product version"


All your sad history of all your legacy is irrelevant. If you project compiles any file(s) with these three lines, your assembly will be compiled into a module with the assembly manifest having the said version. Normally, in modern versions of Visual Studio, these lines are put in the file"/Properties/AssemblyInfo.cs", but it has no special meaning at all. Only the application of these three attributes is important.

Also, "*" means that some components of the version are auto-generated by the build, but I would use it only during development; the final product release build (I hope you are going to create a command-line build script/batch, otherwise it's not a real development cycle :-)) should put some concrete fixed version values.

You got the exact recipe. Good luck.

[EDIT]

Another bonus advice.

Migrate your project to the .NET version supported by Visual Studio you have. Usually, this is not a problem at all.

No need to apologize for using .NET v.2.0 — it was quite a decent version, with generics and anonymous methods. Using it was never anything wrong. But with later versions, you will have such an important features as lambda expression and type inference, both extremely convenient things, as more.

—SA


There was a folder in my solution working folder called Install, which contained a file called 'ApplicationNameinstall.vbproj'. Even though the 'Find in Files' feature of Visual Studio did not find the old version string in it, viewing it with a hex editor showed that in fact, it was there.

I think this file was created by previously running the 'Click Once' installation option. Deleting this and the other 2 files in this folder (autorun.inf and WiRunSQL.vbs) allowed me to rebuild an application.msi with the correct version in it.


I will take a guess

The old version of MSI installer (created with WiX 3.5) had a bug and would not update the version number which was used in VS2005.

Probably see if John's fix above works

Read the old article fix here
http://stackoverflow.com/questions/114165/how-to-implement-wix-installer-upgrade[^]

Other than that but a little more dangerous is to go after the registry entry manually

HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Uninstall


这篇关于设置VB.Net 2005应用程序的版本? (听起来很简单,不是吗?)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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