How to prevent the Program Compatibility Assistant from appearing on Windows Vista

收藏自:http://blogs.msdn.com/astebner/archive/2007/05/17/2705372.aspx

+http://www.debugman.com/simple/index.php?t325.html

How to prevent the Program Compatibility Assistant from appearing on Windows Vista

While researching the root cause of the issue that can cause a Windows XP SP2 block dialog to appear when trying to install the .NET Framework 3.5 beta 1 on Windows Vista (described in more detail in this blog post ), I learned some useful information about the Program Compatibility Assistant (PCA) that I wanted to summarize here.

What kinds of applications are affected by the Program Compatibility Assistant?

The Program Compatibility Assistant monitors setup applications that it detects are not Windows Vista-aware.  The PCA uses a list of well-known names such as setup.exe, install.exe, etc to try to decide whether or not an application is a setup.  The PCA treats all setup applications that do not have an embedded manifest that specifies a requested execution level (asInvoker, highestAvailable or requireAdministrator).

In the case of the .NET Framework 3.5 beta 1, the setup package did not include an embedded manifest specifying a requested execution level, and it was named dotnetfx35setup.exe, which triggers the Windows Vista legacy setup application detection logic.

When does the Program Compatibility Assistant appear?

Once the Program Compatibility Assistant identifies a non-Windows Vista-aware setup application, it will monitor the Programs and Features control panel (previously known as Add/Remove Programs).  If an entry is not created or removed from the Programs and Features control panel, then the PCA treats the process as a failed setup and displays a dialog after the setup process exits that asks if the user wants to attempt to re-install using recommended settings.  In this case, using recommended settings will cause Windows Vista to re-run the setup using Windows XP SP2 compatibility mode.

In the case of the .NET Framework 3.5 beta 1, because the setup application is treated as a non-Windows Vista-aware setup, whenever it returns without creating or removing a Programs and Features control panel entry, the PCA dialog will appear (even if you simply launch setup and cancel on the End User License Agreement page).

How can I opt out of the Program Compatibility Assistant for my setup?

In order to prevent the Program Compatibility Assistant from appearing, you must include an embedded manifest that specifies a requested execution level for your setup executable.  If you wrap the setup executable in a self-extracting package, you must also include an embedded manifest in the self-extracting package too.  Once you do this, Windows Vista will treat your setup as Windows Vista-aware, and it will no longer show the PCA dialog when setup exits after a failure or cancellation.

Where can I find more detailed documentation?

For more detailed information about the Program Compatibility Assistant, I encourage you to check out the following resources:

  • The Windows Vista Developer Story: Application Compatibility Cookbook - http://www.microsoft.com/indonesia/msdn/appcomp.aspx
  • Windows Vista Application Development Requirements for User Account Control Compatibility - http://www.microsoft.com/downloads/details.aspx?FamilyID=BA73B169-A648-49AF-BC5E-A2EEBB74C16B&displaylang=en
Published Thursday, May 17, 2007 9:14 PM by astebner
Filed under: Setup Issues , Miscellaneous , General development topics , Windows Vista

Comments

Friday, May 18, 2007 3:19 AM by symkt

# re: How to prevent the Program Compatibility Assistant from appearing on Windows Vista

Does PCA's detection of Vista-Awareness depend on whether or not UAC is ON/OFF?

I ask this because I have a setup executable that indeed has a manifest specifying 'requireAdministrator'. When canceling out of my setup, the PCA dialog will appear only when UAC is off. And my manifest should be well-formed, since it invokes a UAC dialog upon launch when UAC is on.

Any tips as to how to prevent the PCA dialog from showing up with UAC off?

Wednesday, May 23, 2007 1:22 PM by astebner

# re: How to prevent the Program Compatibility Assistant from appearing on Windows Vista

Hi Symkt - I haven't heard of this issue until now.  Would it be possible for you to zip and send me your setup.exe so I could take a look at this in more detail?  You can send it to Aaron.Stebner (at) microsoft (dot) com.

Saturday, May 26, 2007 5:09 PM by bp9129

# re: How to prevent the Program Compatibility Assistant from appearing on Windows Vista

Hi, I'm trying to downgrade vista to XP pro sp2, but whenever i click install in the windows xp install menu, that damn program compatibility assistant pops and disallows it. Could you help me out?

Sunday, May 27, 2007 10:30 PM by astebner

# re: How to prevent the Program Compatibility Assistant from appearing on Windows Vista

Hi Bp9129 - I haven't tried to install Windows XP from within Windows Vista before, so I don't know for sure if that is expected to work.  Can you try to boot from your Windows XP CD and install from there instead of running it from within Windows Vista?

Thursday, August 02, 2007 6:21 PM by Aaron Stebner's WebLog

# What to do if VS 2008 or .NET Framework 3.5 beta 2 asks for Windows XP SP2 on Windows Vista

I previously posted a description of a bug in VS 2008 beta 1 and .NET Framework 3.5 beta 1 setup that

Thursday, August 02, 2007 7:05 PM by Noticias externas

# What to do if VS 2008 or .NET Framework 3.5 beta 2 asks for Windows XP SP2 on Windows Vista

I previously posted a description of a bug in VS 2008 beta 1 and .NET Framework 3.5 beta 1 setup that

Tuesday, October 16, 2007 12:17 AM by Aaron Stebner's WebLog

# Narrowing down odd behavior in the Program Compatibility Assistant on Windows Vista

Recently, a fellow Microsoft employee found this blog post that I wrote a while back, and he contacted

Tuesday, October 16, 2007 3:20 AM by MSDN Blog Postings » Narrowing down odd behavior in the Program Compatibility Assistant on Windows Vista

# MSDN Blog Postings » Narrowing down odd behavior in the Program Compatibility Assistant on Windows Vista

PingBack from http://msdnrss.thecoderblogs.com/2007/10/16/narrowing-down-odd-behavior-in-the-program-compatibility-assistant-on-windows-vista/

 

 

VC编译出来的应用程序在vista下运行,有可能因为权限问题,不能成功运行。

用以下办法,给应用程序添加一个manifest文件,程序运行时系统就会跳出UAC对话框,获得管理权限。

1.打开应用程序的源代码工程

2.添加一个“custom”资源,"resource type"填24,把资源ID改为1,然后把以下内容复制到资源内容中保存

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<assemblyIdentity
  version="1.0.0.0"
  processorArchitecture="X86"
  name="mulitray.exe.manifest"
  type="win32"
/>
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
  <security>
    <requestedPrivileges>
        <requestedExecutionLevel level="requireAdministrator" uiAccess="false"/>
    </requestedPrivileges>
  </security>
</trustInfo>
</assembly>

3.重新编译应用程序,此时会发现,广用程序的图标在vista下会多出一个小盾标志。

你可能感兴趣的:(windows,.net,Microsoft,application,dialog,behavior)