如何检测项目的安装目录?
我有一个 Visual Studio C# 项目,并且有一个安装程序,可以将文件安装到用户指定的任何目录中。我还有另一个带有本地化语言资源的安装程序,我希望将其安装在上述目录中。
谁能指出我在这方面的正确方向?我想我必须对注册表项做一些事情,但我不知道该怎么做。
编辑:作为记录,我找到了此页面:如何:使用注册表启动条件指定目标目录。我按照说明进行操作,它做了我想做的事。
I have a Visual studio C# project and I have an installer that installs the files into whatever directory the user specifies. I also have another installer with localized language resources and I want that to be installed in the aforementioned directory.
Can anyone point me in the right direction on this? I think I have to do something with registry keys but I don't know what to do.
Edit: For the record, I found this page: How to: Use a Registry Launch Condition to Specify a Target Directory. And I followed the instructions and it did what I wanted it to do.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
通常,您将创建一个注册表子项和 HKEY_LOCAL_MACHINE\SOFTWARE\ 值,然后在第二个安装程序中读回该项以决定将其放置在何处。
类似于 HKLM\SOFTWARE\MyApplication,
然后创建一个名为 InstallPath 的字符串值,并在那里写入第一个安装程序的路径。
根据您正在执行的操作,您可能需要查看 合并模块,用于使用一个 MSI 安装多个组件。
Typically, you would create a registry subkey and value of HKEY_LOCAL_MACHINE\SOFTWARE\ and then just read that key back in your second installer to decide where to put that.
Something like HKLM\SOFTWARE\MyApplication,
Then you make a string value called InstallPath and write the path from your first installer there.
Depending on what you're doing, you may want to have a look at merge modules for installing several components with one MSI.
你走在正确的轨道上。您的第一个安装程序会将其安装路径写入众所周知的注册表项。第二个安装程序将从该众所周知的密钥中读取路径,并将其 dll 放入适当的子文件夹中。
You are on the right track. Your first installer would write it's install path to a well known registry key. The second installer would read the path from that well known key and put it's dlls in the appropriate sub folders.
这是一种方法:
Here is one way to go at it: