Get installed applications in a system

后端 未结 14 1003
遥遥无期
遥遥无期 2020-11-22 08:28

How to get the applications installed in the system using c# code?

14条回答
  •  情歌与酒
    2020-11-22 09:12

    I used Nicks approach - I needed to check whether the Remote Tools for Visual Studio are installed or not, it seems a bit slow, but in a seperate thread this is fine for me. - here my extended code:

        private bool isRdInstalled() {
            ManagementObjectSearcher p = new ManagementObjectSearcher("SELECT * FROM Win32_Product");
            foreach (ManagementObject program in p.Get()) {
                if (program != null && program.GetPropertyValue("Name") != null && program.GetPropertyValue("Name").ToString().Contains("Microsoft Visual Studio 2012 Remote Debugger")) {
                    return true;
                }
                if (program != null && program.GetPropertyValue("Name") != null) {
                    Trace.WriteLine(program.GetPropertyValue("Name"));
                }
            }
            return false;
        }
    

提交回复
热议问题