如何检查文件版本以满足运行我的工具所需的要求 [英] how to check file version to meet the requirement needed to run my tool

查看:51
本文介绍了如何检查文件版本以满足运行我的工具所需的要求的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

美好的一天!

在运行我的工具之前,我必须检查一个文件.要检查的文件在"c:\ code \ example.dll"中.该文件的版本为1.0.21.20

运行我的工具的最低要求是1.0.20.1版.因此,上面给定的文件通过了运行我的工具的要求.工具将运行.如果以上文件版本低于要求怎么办?示例版本1.0.19.1,因此该工具将无法运行.

如何在C#中执行该操作,如果未通过要求,我想显示运行我的工具所需的要求.


期待.


是的!
C#中的-novice-

Good day!

I have to a check a file before running my tool. The file to be check is in "c:\code\example.dll". This file has a version of 1.0.21.20

The minimum requirement to run my Tool is version 1.0.20.1. So the given file above pass the requirement to run my tool. And the Tool will run. What if the file version above is below the requirement. Example version 1.0.19.1 so the tool will not run.

How to execute that in C# and if the requirement did not pass, I want to display the requirement needed to run my Tool.


looking forward.


yepey!
-novice in C#-

推荐答案

基于文件版本信息的答案不完整.也有程序集版本.
文件版本和程序集版本可以不同.最好围绕程序集版本而不是文件版本构建版本控制策略.

请查看我最近对这个问题的回答:
检查文件是否兼容使用的系统 [ ^ ].

—SA
The answer based on file version information is incomplete. There is also assembly version.
File version and assembly version can be different. It''s the best to build versioning strategy around assembly versions, not file versions.

Please see my recent answer to this question:
Checking file if it is compatible in the system used[^].

—SA


您可以使用以下代码检查

You can use below code to check that

System.Diagnostics.FileVersionInfo fileVersionInfo = System.Diagnostics.FileVersionInfo.GetVersionInfo(@"C:\msdia80.dll");
            //Check Version
            if(fileVersionInfo.FileVersion == "Some Conditition")


这篇关于如何检查文件版本以满足运行我的工具所需的要求的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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