在UAC上更改exe的程序名称 [英] Change the program name of exe on UAC

查看:185
本文介绍了在UAC上更改exe的程序名称的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个exe文件,当尝试以管理员身份运行时,该程序名称显示为TestSampleConsoleSign.exe.它是一个带有hello world的简单控制台应用程序.

I have an exe which when tried to run as administrator shows the program name as TestSampleConsoleSign.exe. Its a simple console application with hello world in it.

namespace TestSampleConsoleSign
{
   class Program
   {
    static void Main(string[] args)
    {
        Console.WriteLine("Hello World");
        Console.ReadLine();
    }
  }
}

我也将AssemblyInfo.cs中的AssemblyTitle字段更改为HelloWorld.但是,启用UAC后,程序名称仍显示为TestSampleConsoleSign.exe而不是HelloWorld.我还尝试使用以下方法创建数字证书来签名工具: http://msdn .microsoft.com/en-us/library/ff699202.aspx 并使用以下命令对我的exe签名

I have also changed the AssemblyTitle field in AssemblyInfo.cs to HelloWorld. But when UAC is enabled the program name still shows as TestSampleConsoleSign.exe instead of HelloWorld. I also tried to signtool by creating a digital certificate using this : http://msdn.microsoft.com/en-us/library/ff699202.aspx and signing my exe with following command

signtool sign /f test.pfx /p password /d HelloWorld TestSampleConsoleSign.exe

我在如何将属性更改为UAC上找到了该解决方案?我缺少什么? ?这是强制性的吗?如何将属性更改为UAC?

I found this solution on How change attributes to UAC? What am I missing? Is this mandatory- How change attributes to UAC?

推荐答案

首先,我确认在AssemblyInfo.cs中更改AssemblyTitle是正确的位置.请注意,该字段在Windows资源管理器的属性详细信息页面中显示为文件描述.也许您想再次检查您的AssemblyTitle是否出现在此处,只是为了确保您确实触发了重建.

First I confirm that changing AssemblyTitle in AssemblyInfo.cs is the correct place. Note that this field shows up as File Description in the properties details page of Windows Explorer. Maybe you want to double check whether your AssemblyTitle appears there, just to make sure that you have really triggered a rebuild.

然后我尝试使用不同的证书运行像您一样的控制台应用程序,并且发生了以下情况:

Then I tried running a Console application like yours with different certificates and the following happened:

  • 自行创建的证书(如您的证书):UAC显示程序的可执行文件名称.
  • 具有受信任的根权限的官方"证书:UAC显示文件描述(AssemblyTitle)

但是很有趣:即使我将可执行文件名称更改为包含"Setup"的名称,也不会显示UAC对话框.为了显示UAC对话框,我必须选中以管理员身份运行"复选标记.如果您已包含具有此类设置的app.manifest文件,则默认情况下,以管理员身份运行.

Funny though: even if I change the executable name to something containing "Setup", the UAC dialog was not shown. For the UAC dialog to be shown, I had to check the checkmark "Run as administrator". Running as administrator might be your default, if you have included an app.manifest file with such a setting.

这篇关于在UAC上更改exe的程序名称的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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