Click here to Skip to main content
15,885,896 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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.
Posted

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.

C#
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
}
 
Share this answer
 
v3
it was my wrong , if i download file completely ,product version is with it.
I'm sorry
 
Share this answer
 
it was my wrong , if i download file completely ,product version is with it.
I'm sorry
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900