程序兼容性助手认为我的应用程序是安装程序

发布于 2024-08-07 18:46:25 字数 1017 浏览 5 评论 0原文

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

当我在调试器之外运行该程序时(目前只是一个空表单,没有任何功能),它工作正常,直到我关闭该表单。然后,我从程序兼容性助手中收到一条消息,显示:

此程序可能未正确安装,

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

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

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

我不确定 Vista 上是否会出现这种情况,因为我目前没有访问权限。

更改名称不是一个选项,关闭 UAC 也不是一个选项,因此请不要建议这样做!

编辑:

天啊。

看来,如果满足以下任一条件,UAC 就会坚持下去:

Exe 名称包含单词 Installer

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”也可以是“Setup”。

这令人难以置信,确实如此。显然,一位老 VB6 程序员被调入雷蒙德的 UAC 团队。

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

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

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.

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?

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

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

Edit:

OMG.

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

Exe name contains the word Installer

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'.

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

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.

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)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

做个ˇ局外人 2024-08-14 18:46:25

将其添加到您的清单中。

<?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 都提供下层支持。支持多个平台的应用程序不需要为每个平台提供单独的清单。

取自应用(可执行)清单

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>

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.

Taken from App (executable) manifest.

最笨的告白 2024-08-14 18:46:25

就像 Workshop Alex 会根据文件名进行猜测。

但是您是否尝试过添加清单文件?这使您可以指定运行应用程序所需的访问权限。

MSDN 介绍如何从 Visual Studio 创建一个
另一篇帮助的链接文章。

Like Workshop Alex will make a guess based on filenames.

But have you tried to add a manifest file ? That allows you to spesify what access rights you need to be run the application.

MSDN on how to create one from Visual studio
Another link article that help.

你与昨日 2024-08-14 18:46:25

我刚刚遇到了这个问题,并最终通过确保 AssemblyInfo.cs 文件中的程序集标题和 cs.proj 文件的程序集名称匹配来修复它。当它们不同步时,它会抛出此错误,使它们相同导致它消失。不确定它是否适用于您的情况,但相同的错误类似的情况,可能值得一试,并避免一起忽略错误的接受答案。

I just had this problem and ended up fixing it by making sure my assembly title within the AssemblyInfo.cs file and the assembly name of my cs.proj file matched up. When they weren't synced up it was throwing this error, making them the same caused it to go away. Not sure if it applies to your situation, but same error similar circumstances, might be worth a try and avoid the accepted answer of ignoring the error all together.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文