2

我需要加密将在我们的实验室中使用的应用程序的 .config 文件中的连接字符串。为此,我按照此处的说明进行操作http://boettr.wordpress.com/2010/05/20/simple-way-to-encrypt-app-config-through-wix-3-5-and-vs2010-using -c代码/

只要我不将应用程序安装到 Program Files 或 Program Files (x86) 目录,工作就很好。我没有收到任何错误,但 .config 文件也永远不会被加密。我尝试设置模拟标志并将其设置为延迟运行,但在使用模拟时收到错误,它必须在 InstallInitialize 之后和 InstallFinalize 之前发生。但是,除非在 InstallFinalize 之后运行,否则自定义操作将不起作用。

我的 product.wxs 中的代码

<InstallExecuteSequence>
  <Custom Action="LaunchFile" After="InstallFinalize">NOT Installed</Custom>
</InstallExecuteSequence>
<Fragment>
<CustomAction Id="LaunchFile" FileKey="Encryption" ExeCommand="[INSTALLDIR]"/>

我可以在安装后运行 encryption.exe 并且它可以工作,但在它实际执行之前我确实收到了 UAC 警告。任何帮助,将不胜感激。

4

1 回答 1

2

在“InstallFiles”之后执行延迟应该可以让您获得所需的权限并保证文件在那里。

<InstallExecuteSequence>
  <Custom Action="LaunchFile" After="InstallFiles" Impersonate="no" Execute="deferred">NOT Installed</Custom>
</InstallExecuteSequence>
于 2014-04-08T15:32:48.477 回答