程序兼容性助理认为我的应用是安装程序 [英] Program Compatibility Assistant thinks my app is an installer

查看:27
本文介绍了程序兼容性助理认为我的应用是安装程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 Win 7 RTM x64 上创建了一个 .NET C# WinForms 应用程序,假设我调用了 DataInstaller.

I have created a .NET C# WinForms application on Win 7 RTM x64, which let's say I have called DataInstaller.

当我在调试器之外运行这个程序时(目前只是一个没有功能的空表单),它可以正常工作,直到我关闭表单.然后我从程序兼容性助手那里收到一条消息:

When I run this program outside of the debugger (just an empty form with no functionality at the moment), it works fine until I close the form. I then get a message from the Program Compatibility Assistant that says:

这个程序可能没有正确安装

This program might not have installed correctly

然后我可以选择使用推荐的设置重新安装,或者说安装确实按预期工作.

I then get the option to reinstall using recommended settings or to say that the install did work as expected.

如果我将应用命名为DataThingy",这不是问题,我猜这与名为 *Setup 的程序获得 UAC 盾牌图标的方式有关.

If I name the app 'DataThingy' this isn't an issue, I guess this is related to the way that programs called *Setup gain a UAC shield icon.

我假设我可以在应用程序清单中放入一些简单的东西来防止这种情况发生?

I assume that there will be something simple that I can put in the application manifest to prevent this?

我不确定这是否发生在 Vista 上,因为我目前没有访问权限.

I'm not sure if this occurs on Vista as I don't have access currently.

更改名称不是一个选项,关闭 UAC 不是一个选项,所以请不要建议这个!

Changing the name is not an option and turning off UAC is not an option so please don't suggest this!

天哪.

看来,如果以下任何一项为真,UAC 就会坚持下去:

It seems that if any of the following are true, UAC sticks its oar in:

Exe 名称中包含 Installer 一词

Exe name contains the word Installer

AssemblyInfo.cs

AssemblyInfo.cs

AssemblyTitle contains the word 'Installer'
    e.g. [assembly: AssemblyTitle("DataInstaller")]
AssemblyProduct contains the word 'Installer'
    e.g. [assembly: AssemblyProduct("Data Installation Utility")]

安装程序"也可以是安装程序".

'Installer' can also be 'Setup'.

难以置信,确实如此.显然,一位老 VB6 程序员被调到了雷德蒙德的 UAC 团队.

It beggars belief, it really does. Obviously one of the old VB6 programmers got relocated into the UAC team over at Redmond.

我仍然需要解决方法,我不准备接受我的应用程序不可能被称为安装程序,因为它不涉及注册表或将任何文件放入 Program Files 文件夹中.

I still need a workaround, I'm not prepared to accept that my application can't possibly be an called an installer because it doesn't touch the registry or put any files in the Program Files folder.

我假设如果我尝试执行名为 IAmAVirus.exe 的应用程序,UAC 会将计算机完全锁定.(其实我不敢尝试,因为我不完全相信我只是在傻)

I assume that UAC would put the machine into total lockdown if I tried to execute my application called IAmAVirus.exe. (Actually, I daren't try it because I'm not entirely convinced that I'm just being silly)

推荐答案

将此添加到您的清单中.

Add this into your manifest.

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<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 app support for Windows 8 -->
    <supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}"/>
    <!--The ID below indicates app support for Windows 8.1 -->
    <supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}"/>
  </application>
</compatibility>

上一个示例中所有操作系统的 GUID 都提供了低级支持.支持多个平台的应用不需要为每个平台提供单独的清单.

The GUIDs for all the operating systems in the previous example provide down-level support. Apps that support multiple platforms do not need separate manifests for each platform.

取自 应用(可执行)清单.

这篇关于程序兼容性助理认为我的应用是安装程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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