Reputation: 8682
AssemblyName.GetAssemblyName("").Version.ToString() will give the version number ,,but i need to get version number from registry
registry path is under MY computer -> HKEY_LOCAL_MACHINE->SOFTWARE->
leaf->monitor here current version file is there,,from there we need to
fetch version number
Upvotes: 0
Views: 684
Reputation: 26790
Wael's code works fine, but there's a couple other (slightly syntactically cleaner) ways to do it, for example:
OpenSubKey
knows how to open several subkeys at once:RegistryKey key = Registry.LocalMachine.OpenSubKey(@"Software\leaf\monitor");
OpenSubKey
):string version = Registry.GetValue(@"HKEY_LOCAL_MACHINE\Software\leaf\monitor", "version", "0");
Upvotes: 3
Reputation: 23044
you can use the following code to get the version key value:
RegistryKey key= Registry.LocalMachine.OpenSubKey("SOFTWARE").OpenSubKey("leaf").OpenSubKey("monitor ");
string version = key.GetValue("version");
Edit: check now :)
Upvotes: 1