Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C# file
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 7-Jun-13 3:52am
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

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
      }
  Permalink  
v3
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

it was my wrong , if i download file completely ,product version is with it.
I'm sorry
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 3

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

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

  Print Answers RSS
0 OriginalGriff 330
1 Sergey Alexandrovich Kryukov 279
2 BillWoodruff 245
3 Afzaal Ahmad Zeeshan 215
4 CPallini 205
0 OriginalGriff 5,635
1 DamithSL 4,496
2 Maciej Los 3,942
3 Kornfeld Eliyahu Peter 3,480
4 Sergey Alexandrovich Kryukov 3,180


Advertise | Privacy | Mobile
Web01 | 2.8.141216.1 | Last Updated 7 Jun 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100