如何防止Vista上的“此程序可能没有正确安装”消息

时间:2009-05-22 14:42:15

标签: windows-installer installer uac windows-appcompat-platform

我有一个产品安装程序可执行文件,可以将一些文件复制到用户的硬盘上。它不是正常意义上的典型安装程序(它不会向“开始”菜单或“程序文件”文件夹添加任何内容)。

每次在Vista上运行安装程序时,在exe终止后,Vista会生成一个任务对话框:

  • 此程序可能未正确安装
  • 使用推荐设置重新安装
  • 此程序已正确安装

是否需要从exe或注册表项中调用一个函数进行设置,以向操作系统指示程序是否正确安装(或者至少要压缩此消息)?

相关问题: "This program might not have installed correctly" message in Windows 7 RC(针对Windows 7特定问题)

6 个答案:

答案 0 :(得分:44)

在程序的清单文件中包含此部分:

<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
  <application>
    <!--The ID below indicates application support for Windows Vista -->
      <supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}"/>
    <!--The ID below indicates application support for Windows 7 -->
      <supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}"/>
    <!--The ID below indicates application support for Windows 8 -->
      <supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}"/>
    <!--The ID below indicates application support for Windows 8.1 -->
      <supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}"/>
    <!--The ID below indicates application support for Windows 10 -->
      <supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}"/>

  </application>
</compatibility>

它会通过声明您的应用与Vista和Win 7兼容来抑制程序兼容性助手。

答案 1 :(得分:7)

您需要在注册表的AppCompat部分添加一些信息。

请参阅this link并查找“如何禁用程序兼容性助手警告”。

此外,显然a method涉及将清单文件添加到您的安装程序可执行文件中,以将其标记为“Vista-aware”。

答案 2 :(得分:3)

您应该尝试的第一件事是使用requestedExecutionLevel

添加“Vista清单”

如果这还不够(在UAC关闭时单击取消卸载等),您需要使用未记录的内容,例如将PE标头中的图像版本字段设置为6.0

答案 3 :(得分:3)

弹出此消息的原因之一是系统认为您正在运行安装程序,但在添加/删除程序列表中找不到该应用程序的条目。

我不知道您的应用是否属于这种情况,但值得检查。

答案 4 :(得分:0)

这似乎有更多原因。 如果你重命名你的应用程序还要记住程序集信息中的名称,它们都必须相同,否则就是nag-screen&#34;这个程序可能没有正确安装&#34;可能弹出:-P enter image description here

也可以直接在AssemblyInfo.vb / .cs文件中修改

答案 5 :(得分:0)

我通过更改程序集标题解决了该问题。