how to get the current version's assembly number`
-
hi i have devoloped windows application, i wanna update that perticular developed version with my current(yet to develop)windows application can u please let me know how to fine and compare the versions, i got my current(yet to develop-update version's) assembly by using Assembly.GetExecutingAssembly().ToString() but, i want knw the current deployed version's assembly name so that i can find and update if its lower version else give a prompt saying this is already updated version.. hope u got my requirement thnx in advance prashanth
-
hi i have devoloped windows application, i wanna update that perticular developed version with my current(yet to develop)windows application can u please let me know how to fine and compare the versions, i got my current(yet to develop-update version's) assembly by using Assembly.GetExecutingAssembly().ToString() but, i want knw the current deployed version's assembly name so that i can find and update if its lower version else give a prompt saying this is already updated version.. hope u got my requirement thnx in advance prashanth
Assembly myAssembly = Assembly.GetExecutingAssembly(); FileVersionInfo info = FileVersionInfo.GetVersionInfo(myAssembly.Location); // info.ProductVersion gives you the complete version. // fileVersionInfo also contains many other property for details. Hope this helps. Regards :)
-
Assembly myAssembly = Assembly.GetExecutingAssembly(); FileVersionInfo info = FileVersionInfo.GetVersionInfo(myAssembly.Location); // info.ProductVersion gives you the complete version. // fileVersionInfo also contains many other property for details. Hope this helps. Regards :)
Nice to find an expert on an important function. y any chance, do you know if the following snippet is how to get the hinstance we should pass to Bitmap.FromResource()?
String s = "MT_ConfirmREFRESH"; IntPtr h = Process.GetCurrentProcess( ).Handle; try { Glyph1.GMap = Bitmap.FromResource( h, s ); } catch { throw new Exception( "Bitmap resource " + s + " not found from process handle " + h.ToString( ) + "." ); }
Documentation indicates that hinstance is supposed to be "A handle to an instance of the executable file that contains the resource." The snippet is part of a method of a class belonging to a .DLL to which the resource(s) have been added by the visual Project.Properties... Add existing file... process. When this code fails, the FCL message only indicates that "the" (a) parameter is not valid. The resources ostensibly exist. I assume the handle value is the most probable candidate for the problem, unless there is some problem with the registration of the resources which I am not aware of. Much thanks, m
-
Assembly myAssembly = Assembly.GetExecutingAssembly(); FileVersionInfo info = FileVersionInfo.GetVersionInfo(myAssembly.Location); // info.ProductVersion gives you the complete version. // fileVersionInfo also contains many other property for details. Hope this helps. Regards :)
In other words, the following approach does identify the assembly I need to identify, but I run into a dead end trying to get an IntPtr handle from the "ModuleHandle" struct:
Type t = this.GetType( ); Assembly a = Assembly.GetAssembly( t ); // SUCCESSFULLY RETURNS THE RIGHT ASSEMBLY, BUT HOW DO WE GET AN IntPtr HANDLE TO THIS? ModuleHandle mh = a.GetModule( "APC" ).ModuleHandle; // CAN WE GET AN IntPtr TO THE HINSTANCE SOMEHOW FROM mh?
Do you know of a way to get the IntPtr value that will return the resources we need to find with Bitmap.FromResource()?
-
In other words, the following approach does identify the assembly I need to identify, but I run into a dead end trying to get an IntPtr handle from the "ModuleHandle" struct:
Type t = this.GetType( ); Assembly a = Assembly.GetAssembly( t ); // SUCCESSFULLY RETURNS THE RIGHT ASSEMBLY, BUT HOW DO WE GET AN IntPtr HANDLE TO THIS? ModuleHandle mh = a.GetModule( "APC" ).ModuleHandle; // CAN WE GET AN IntPtr TO THE HINSTANCE SOMEHOW FROM mh?
Do you know of a way to get the IntPtr value that will return the resources we need to find with Bitmap.FromResource()?
Hello, I'm not an expert at all, but I found this article, where it is done by an "Kernel32.dll" method call. http://www.codeproject.com/cs/miscctrl/XPTaskBar.asp[^]
\[DllImport("Kernel32.dll", CharSet = CharSet.Auto, SetLastError = true)\] public static extern IntPtr LoadLibrary(string lpFileName);
Hope it helps! All the best, Martin
-
Hello, I'm not an expert at all, but I found this article, where it is done by an "Kernel32.dll" method call. http://www.codeproject.com/cs/miscctrl/XPTaskBar.asp[^]
\[DllImport("Kernel32.dll", CharSet = CharSet.Auto, SetLastError = true)\] public static extern IntPtr LoadLibrary(string lpFileName);
Hope it helps! All the best, Martin
Thanks, Martin, but the problem here is the approach is not CLS compliant. We need to be able to do this with managed code. It's "as if" Microsoft left out a vital bridge so that, as we are obstructed from a managed solution, we are forced to write Microsoft-dependent approaches.
-
Thanks, Martin, but the problem here is the approach is not CLS compliant. We need to be able to do this with managed code. It's "as if" Microsoft left out a vital bridge so that, as we are obstructed from a managed solution, we are forced to write Microsoft-dependent approaches.