Wix 卸载快捷方式不起作用 [英] Wix Uninstall Shortcut not working

查看:28
本文介绍了Wix 卸载快捷方式不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试为我的应用程序创建一个卸载快捷方式,我正在使用此链接中的确切标记:

I am trying to create an uninstall shortcut for my application and I am using the exact markup from this link:

http://wixtoolset.org/documentation/manual/v3/howtos/files_and_registry/create_uninstall_shortcut.html

它会在程序菜单文件夹下的应用程序目录中创建一个快捷方式.

It creates a shortcut in the application directory under programs menu folder.

问题是在单击卸载快捷方式时,我收到以下错误消息:无法打开此安装包.请验证该包是否存在并且您可以访问它,或联系应用程序供应商以验证此是有效的 Windows 安装程序包"

The problem is that on clicking the uninstall shortcut, I get the following error message: "This installation package could not be opened. Verify that the package exists and that you can access it, or contact the application vendor to verify that this is a valid Windows Installer Package"

以下是我在 .wxs 文件中的内容

Below is what I have in the.wxs file

    <Directory Id="TARGETDIR" Name="SourceDir">
        <Directory Id="ProgramFilesFolder">
            <Directory Id="APPLICATIONROOTDIRECTORY" Name="MyApplication"/>
        </Directory>
        <Directory Id="ProgramMenuFolder">
            <Directory Id="ApplicationProgramsFolder" Name="MyApplication"/>
        </Directory>
    </Directory>

    <DirectoryRef Id="APPLICATIONROOTDIRECTORY">
        <Component Id="myapplication.exe" Guid="xxxxxxxx-1BF3-4394-ABE4-CABB29D6454C">
            <File Id="myapplication.exe" Source="myapplication.exe" KeyPath="yes" Checksum="yes"/>
        </Component>
        <Component Id="documentation.html" Guid="xxxxxxxx-44F3-4E6C-87B9-903CF17EF002">
            <File Id="documentation.html" Source="documentation.html" KeyPath="yes"/>
        </Component>
    </DirectoryRef>

    <DirectoryRef Id="ApplicationProgramsFolder">
        <Component Id="ApplicationShortcut" Guid="xxxxxxxx-F7C4-40D6-930C-3BD78143A0EF">
            <Shortcut Id="ApplicationStartMenuShortcut" 
                 Name="MyApplication" 
               Description="Uninstall Test"
                Target="[#myapplication.exe]"
                      WorkingDirectory="APPLICATIONROOTDIRECTORY"/>
            <!-- Step 1: Add the uninstall shortcut to your installer package -->
            <Shortcut Id="UninstallProduct"             
                      Name="Uninstall My Application"
                      Description="Uninstalls My Application"
                      Target="[System64Folder]msiexec.exe"
                      Arguments="/x xxxxxxxx-1D27-4656-AB3F-41A2047CB6C0"/>
            <RemoveFolder Id="ApplicationProgramsFolder" On="uninstall"/>
            <RegistryValue Root="HKCU" Key="Software\Microsoft\UninstallTest" Name="installed" Type="integer" Value="1" KeyPath="yes"/>
       </Component>
    </DirectoryRef>

    <Feature Id="MainApplication" Title="Main Application" Level="1">
        <ComponentRef Id="myapplication.exe" />
        <ComponentRef Id="documentation.html" />
        <ComponentRef Id="ApplicationShortcut" />   
    </Feature>
</Product>

我还无法找到解决此问题的方法.任何帮助,将不胜感激.谢谢

I am unable to find a solution to this problem yet. Any help would be appreciated. Thanks

推荐答案

在开始菜单中放置卸载快捷方式一直违反指导方针 - 至少从 2000 年代初开始,以及新的开始菜单在 Windows 8 中引入的tiles 这样做确实是非常不可取的.请阅读以下文章:开始屏幕上的桌面应用程序块(注意事项).

Putting uninstall shortcuts in the start menu has always been against guidelines - at least since the early 2000s, and with the new start menu tiles introduced in Windows 8 it is very unadvisable indeed to do so. Please read the following article: Desktop App Tiles on the Start Screen (do's and don'ts).

我没有要测试的系统,但 Windows 8 实际上可能隐藏卸载快捷方式.您也应该避免使用其他快捷方式(自述文件、网站快捷方式等...).不过,我刚刚在 Windows 10 上进行了测试,确实可以在开始菜单中看到卸载快捷方式.

I don't have a system to test on, but Windows 8 may actually hide uninstall shortcuts. You should avoid other shortcuts as well (readme files, website shortcuts, etc...). I just tested on Windows 10 though, and I can indeed see an uninstall shortcut in the start menu.

在这种特殊情况下,我的建议实际上是消除您的自定义快捷方式并以这种方式宣布成功.抱歉,如果这不适合您,但如果您不介意我这么说:不要与基本的 Windows 设计作斗争 - 它们会反击,您将永远后悔试图驯服它们.只是给野兽装上鞍,让它撕裂:-).

In this particular case my advise would actually be to eliminate your custom shortcut and declare success that way. Sorry if this isn't ideal for you, but if you don't mind me saying so: don't fight the basic Windows designs - they fight back, and you will always regret trying to tame them. Just saddle up the wild beast and let it rip :-).

话虽如此,您可能如 Chris Painter 所建议的那样在卸载快捷方式中与 ProductCode 不匹配.对于调试,您可以尝试将:Arguments="/x xxxxxxxx-1D27-4656-AB3F-41A2047CB6C0"/> 更改为 Arguments="/x [ProductCode]"/>代码>所以它看起来像这样:

With that being said, you may have mismatched the ProductCode in the uninstall shortcut as Chris Painter suggests. For debugging you could try changing: Arguments="/x xxxxxxxx-1D27-4656-AB3F-41A2047CB6C0"/> to Arguments="/x [ProductCode]"/> so it looks like this:

<Shortcut Id="UninstallProduct"             
           Name="Uninstall My Application"
           Description="Uninstalls My Application"
           Target="[System64Folder]msiexec.exe"
           Arguments="/x [ProductCode]"/>

记得卸载所有实例,重建然后安装新版本来测试这一切.

Remember to uninstall all instances, rebuild and then install the new version to test all this.

我进行了一个快速测试,这在 Windows 10 上有效.尽管在我看来,您仍然应该删除该快捷方式.有趣的是,在开始菜单中看不到在同一位置(文件是在磁盘上创建的)添加 Internet 快捷方式(这可能表明快捷方式也隐藏在 Windows 10 中).

I ran a quick test and this worked on Windows 10. You should still remove that shortcut though in my opinon. Interestingly adding an Internet shortcut in the same location (file was created on disk) was not visible in the start menu (which may indicate shortcut hiding in Windows 10 as well).

供参考:

这篇关于Wix 卸载快捷方式不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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