C# 如何更改exe文件的文件和产品版本
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/17549081/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
how to change file & product version of a exe file
提问by Ranger
I am using Microsoft Visual C# 2010 Express. I have to change the version of my exe file. Please tell me how to do it, either by my C# code, or by batch file.
我正在使用 Microsoft Visual C# 2010 Express。我必须更改我的 exe 文件的版本。请告诉我怎么做,要么通过我的 C# 代码,要么通过批处理文件。
采纳答案by Basuro
Somewhere in your code (favorably in AssemblyInfo.csin the Propertiesfolder of your project), put this:
某处在你的代码(在良好AssemblyInfo.cs的在Properties你的项目的文件夹),把这个:
[assembly: AssemblyVersion("1.0.0.0")]
Also possible is the file version attribute:
也可能是文件版本属性:
[assembly: AssemblyFileVersion("1.0.0.0")]
Make sure that you only have one instance of AssemblyVersionand/or AssemblyFileVersionattributes in a single assembly - everything else won't compile.
确保在单个程序集中只有一个AssemblyVersion和/或AssemblyFileVersion属性的实例- 其他所有内容都不会编译。
回答by Tanmay Nehete
You can change the Exe Version through an Assembly file. There are 2 options:
您可以通过程序集文件更改 Exe 版本。有2个选项:
1st option is is to edit the assembly file:
第一个选项是编辑程序集文件:
[assembly: AssemblyTitle("TApplciation Name")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("")]
[assembly: AssemblyCopyright("Copyright ? 2015")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: AssemblyVersion("5.8.3")]
[assembly: AssemblyFileVersion("5.8.3")]
2nd option is through project Property. Go To Project Property and click on the button which is circled:


