比较两个文件,设置产品版本 [英] Compare Two file,Set Product version

查看:118
本文介绍了比较两个文件,设置产品版本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨。



i有框架需要将本地的dll文件(模块)与服务器中的相应文件进行比较,如果新版本可用,请下载< br $>


i有问题,当我用我的服务下载文件接收文件(1024字节1024字节和合并字节来创建文件)时,我无法设置产品版本文件编程。



我可以用C#设置文件的产品版本吗?



你知道其他吗?方式二比较两个文件(否则容量因为不正确)?



请帮帮我。



谢谢,



最好的问候。

Hi.

i have framework that need to compare a dll file (module) in local with corresponding in server,if new version was available ,download it,

i have a problem,when i download a file with my service that receive a file (1024 byte 1024 byte and merge bytes to create file) i can not set Product version for file programmatically.

Can i set Product version for a file in C#?

Do you know other way two compare two file (else capacity because is not correct)?

Please help me.

thanks,

Best Regards.

推荐答案

我认为你不能一次更改程序集版本它已被编译。虽然你可以比较两个单独的dll文件的汇编版本。



I don't think you can change the assembly version once it's been compiled. Although you can compare the assembly versions of two separate dll files.

string existingAssemblyPath = "foo\\bar.dll";
System.Reflection.Assembly existingAssemby = System.Reflection.Assembly.Load(existingAssemblyPath);
Version existingVersion = existingAssemby.GetName().Version;

byte[] downloadedBytes; //assign download file bytes
System.Reflection.Assembly newAssemby = System.Reflection.Assembly.Load(downloadedBytes);
Version newVersion = newAssemby.GetName().Version;

if (newVersion > existingVersion)
{
  //save file
}


这是我的错,如果我完全下载文件,产品版本就可以了。

对不起
it was my wrong , if i download file completely ,product version is with it.
I'm sorry


这是我的错,如果我完全下载文件,产品版本就可以了。

对不起
it was my wrong , if i download file completely ,product version is with it.
I'm sorry


这篇关于比较两个文件,设置产品版本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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