"SystemFolder"在WIX和C#中 [英] "SystemFolder" in WIX and C#

查看:64
本文介绍了"SystemFolder"在WIX和C#中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我用WiX创建的安装程序会使用SystemFolder变量将DLL以及C#应用程序安装到另一个文件夹中.我想直接从应用程序引用DLL.我是否需要查找注册表项以找到SystemFolder的位置?

An installer I have created with WiX installs a DLL using the SystemFolder variable, as well as a C# app into another folder. I want to directly reference the DLL from the app. Do I need to look up registry keys to find where the SystemFolder is?

推荐答案

否,您不需要查询注册表. Windows Installer具有一系列内置属性,这些属性可以自动解析为特殊的知名位置,例如SystemFolder.

No, you don't need to query the registry. Windows Installer has a series of built-in properties that automatically resolve to special well known locations such as SystemFolder.

请参见系统文件夹属性以获取更多常规信息.对于WiX,只需将Directory元素创建为TARGETDIR Directory元素的直接子代:

See System Folder Properties for more general information. For WiX, just create a Directory element as a direct child of the TARGETDIR Directory element:

<Directory Id="TARGETDIR" Name="SourceDir">
  <Directory Id="SystemFolder" Name="SystemFolder" />
</Directory>

如果您已经知道这一点,并且想知道如何从C#引用DLL,则SystemFolder处于搜索路径中,因此我不确定您为什么必须这样做.如果是我,我会将C#编译为x86(AnyCPU现在有点不流行了)并使用:

If you already know this and want to know how to reference the DLL from C#, SystemFolder is in the search path so I'm not sure why you'd have to. If it was me, I'd compile the C# as x86 ( AnyCPU is somewhat out of vogue now ) and use:

string myDllPath = Path.Combine( System.Environment.SystemDirectory, "my.dll" );

这篇关于"SystemFolder"在WIX和C#中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆