程序兼容性助手认为我的应用程序是安装程序
我在 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
将其添加到您的清单中。
取自应用(可执行)清单。
Add this into your manifest.
Taken from App (executable) manifest.
就像 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.
我刚刚遇到了这个问题,并最终通过确保 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.