how can get the path from installer and how set in my app?

让人想犯罪 __ 提交于 2019-12-06 02:50:36
swissben

If you use Visual Studio, you can right click on the setup project -> View -> Registry and then set the registry key you like.

Check out this sites:

msi - Set InstallPath registry key

Registry Settings Management (MSDN)

If it was installed using Windows Installer (.MSI files), you can use the MsiGetComponentPath API:

    [DllImport("msi.dll", CharSet = CharSet.Unicode)]
    private static extern int MsiGetComponentPath(string szProduct, string szComponent, StringBuilder lpPathBuf, ref int pcchBuf);

Call it like this:

int len = 256;
StringBuilder sb = new StringBuilder(len);
MsiGetComponentPath(productCode, componentId, sb, ref len);
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!