汇编文件版本,仅主要和次要 [英] Assembly file version, just Major and Minor

查看:67
本文介绍了汇编文件版本,仅主要和次要的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用这些行来获取组装文件的版本:

I use these lines to get the Assembly file version:

            System.Reflection.Assembly assembly = System.Reflection.Assembly.GetExecutingAssembly();
            FileVersionInfo fvi = FileVersionInfo.GetVersionInfo(assembly.Location);
            string LVersion = fvi.FileVersion;

            LauncherVersion.Content = "v" + LVersion;

但我只想拥有主要版本和次要版本,而不是Build and Revision.

but i want to have just Major And Minor version, not Build and Revision.

推荐答案

Ailincai Rares,

Hi Ailincai Rares,

感谢您在此处发布帖子,对您的回复表示歉意.

Thank you for posting here and sorry for late reply.

对于您的问题,请尝试以下代码.

For your question, please try the following code.

 System.Reflection.Assembly assembly = System.Reflection.Assembly.GetExecutingAssembly();
            Version version = assembly.GetName().Version;
            Console.WriteLine("Major:{0},Minor:{1},Build:{2},Revision:{3}", version.Major, version.Minor, version.Build, version.Revision);
            Console.ReadKey();

我希望这会有所帮助.

最好的问候,

温迪


这篇关于汇编文件版本,仅主要和次要的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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