“SystemFolder” in WIX and C#

风格不统一 提交于 2019-12-23 07:25:54

问题


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?


回答1:


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.

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>

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" );


来源:https://stackoverflow.com/questions/9940731/systemfolder-in-wix-and-c-sharp

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