I am writing a Windows Service for generating CAD drawings and I need to detect which version is installed in the system.
What is the best way to get the installed AutoCAD version in a Windows Server environment? I know that I can get this info from the registry, but from which key? Is there any specific one for all the AutoCAD versions?
Yes, you can. Exactly you can found it here:
HKEY_CURRENT_USER\SOFTWARE\Autodesk\AutoCAD
Then you can find value string name: CurVer It will say installed version.
The best way is to use Registry Key:
RegistryKey key = Registry.LocalMachine.OpenSubKey("SOFTWARE\\Autodesk\\AutoCAD");
var stringArray = key.GetSubKeyNames();
Now, stringArray is an array of strings containing all versions of installed AutoCADs.
Note1: It returns something like "R19.1" which you can easily link to the AutoCAD version, for example, "R19.1" is for AutoCAD 2021.
Note2: Don't forget to install Microsoft.Win32.Registry NuGet Package and include Microsoft.Win32.Registry.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.