3

我们有多个配置文件。根据选择的环境,正确的文件被复制,其余的文件应该被删除。
我正在使用RemoveFile,但这并没有删除任何内容,或者可能是我没有正确使用它。在复制所有文件之后,有人可以举一个在安装过程中删除的示例*.config[INSTALLDIR]

4

2 回答 2

4

在下面的示例中RemoveFile,用于删除.lnk卸载时的所有图标(扩展名),也将使用删除父文件夹RemoveFolder

<DirectoryRef Id="DirName">
  <Component Id="cmpName" Guid="{429BC364-BE5F-4EC8-9AB9-8A522F8EC089}">
    <RemoveFile Id="removeDesktopShortcuts" On ="uninstall" Name="*.lnk"/>
    <RemoveFolder Id="RemoveFolder1" On="uninstall"/>
  </Component>
</DirectoryRef>
于 2012-08-17T05:37:48.367 回答
-5

你为什么不选择自定义操作。在 C# 或其他中创建一个方法,然后在“InstallFinalize”之后调用它。

例子 :

[CustomAction]
public static ActionResult RemoveConfigs(Session session)
{ 
    string configfiles = "\"" + session["INSTALLDIR"].ToString() + "*.config\"" ;
    System.Diagnostics.Process.Start("cmd.exe", "/C del " + configfiles);

    return ActionResult.Success;
}

在 CustomAction.wxs 添加

<Custom Action="ZA_RemoveConfigs" After="InstallFinalize">NOT INSTALLED AND NOT REMOVE</Custom>
于 2011-08-24T16:45:29.957 回答