Reasons for getting the Program Compatibility Assistant dialog?

扶醉桌前 提交于 2019-12-03 16:16:54

问题


What are possible reasons for getting the Program Compatibility Assistant dialog after my application closes?


(source: microsoft.com)

EDIT: Program Compatibility Assistant: frequently asked questions

I realize this question has already been asked on S.O.

  • Program Compatibility Assistant thinks my app is an installer
  • Windows 7 Program Compatibility Assistant appeared for my app. Why?
  • Why I receive a message from the Program Compatibility Assistant?
  • How do I prevent programmatically the “Program Compatibility Assistant” in Vista (and Windows 7) from appearing?

However, my app:

  1. Only gets PCA after it closes
  2. Does not attempt to do anything that requires elevated privileges (I don't think)
  3. Does not get PCA when run from IDE
  4. Is not an installer/setup program
  5. Does not have "installer" or "setup" in the program name
  6. Does not throw an exception when it closes, or exit with a code other than 0 (I don't think)
  7. Does not get PCA if I add <compatibility> node to application manifest

Note #6, with the following app.manifest, I no longer get the PCA:

<?xml version="1.0" encoding="utf-8"?>
<asmv1:assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1" xmlns:asmv1="urn:schemas-microsoft-com:asm.v1" xmlns:asmv2="urn:schemas-microsoft-com:asm.v2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <assemblyIdentity version="1.0.0.0" name="MyApplication.app"/>
  <trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
    <security>
      <requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3">
        <requestedExecutionLevel level="asInvoker" uiAccess="false" />
      </requestedPrivileges>
    </security>
  </trustInfo>
  <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}"/>
    </application>
  </compatibility>
</asmv1:assembly>

So that second part seems to fix it, but I am worried that my application is still doing something that I am unaware of.

To be clear, I'm asking a 2 part question:

  1. What issues can cause the PCA dialog to appear?
  2. Is the <compatibility> node absolutely necessary in order to avoid the PCA dialog? Or might I still be doing something wrong?

回答1:


This MSDN article describes the many conditions that can cause the Program Compatibility Assistant to kick in. I would review the set of scenarios that it describes and see whether any of them apply to your program. I do see causes for PCA dialogs outside of the conditions you ruled out (e.g., attempting to create a new folder under %ProgramFiles%).



来源:https://stackoverflow.com/questions/5098747/reasons-for-getting-the-program-compatibility-assistant-dialog

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