在调试模式下运行应用程序时,清单不会强制 Visual Studio 2013 在管理员下重新启动 [英] Manifest does not force Visual Studio 2013 to restart under Admin when running application in Debug mode

查看:23
本文介绍了在调试模式下运行应用程序时,清单不会强制 Visual Studio 2013 在管理员下重新启动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这适用于 VS2010VS2012.但是在 VS2013 应用程序中(通过按运行"或 F5)只是以我的用户权限启动,无法访问某些资源(我使用的是 HttpListener).

This worked in VS2010 and VS2012. But in VS2013 application (by pressing "Run" or F5) is just starts with my user's rights and cannot access some resources (I'm using HttpListener).

<trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
  <security>
    <requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3">
      <requestedExecutionLevel level="requireAdministrator" uiAccess="false" />
    </requestedPrivileges>
  </security>
</trustInfo>

我尝试谷歌,尝试生成新的清单,从 MSDN 复制它的内容,但没有任何帮助.VS2013 的这部分有什么变化吗?

I tried to google, tried to generate new manifest, copied it's content from MSDN, but nothing helped. Did something changed in this part of VS2013?

更新 1:
那是一部分.这是完整的清单内容:

Update1:
That was a part. Here is complete manifest content:

<?xml version="1.0" encoding="utf-8"?>
<asmv1:assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1" xmlns:asmv1="urn:schemas-microsoft-com:asm.v1" xmlns:asmv2="urn:schemas-microsoft-com:asm.v2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<assemblyIdentity version="1.0.0.0" name="MyApplication.app"/>
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
<security>
  <requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3">
    <requestedExecutionLevel level="requireAdministrator" uiAccess="false" />
  </requestedPrivileges>
</security>
</trustInfo>

<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
  <application></application>
</compatibility>

</asmv1:assembly>

更新 2:
Okey 这里是一个简单的例子:当我运行编译的 .exe 文件时,UAC 要求管理员权限.但是当我从 VS2013(通过按运行"或 F5)运行它时,它没有!如果您使用 VS2012/VS2010 打开同一个项目,他们会要求在管理员下重新启动.
您可以快速检查一下:
VS2013 中创建控制台应用程序,添加清单并设置 level="requireAdministrator".然后运行或按 F5(VS2013 在按 Ctrl-F5 时在管理员下运行应用程序).
但这不是VS2012/VS2010的行为!
我们如何才能获得旧的行为?

Update2:
Okey here is simple example: when I run compiled .exe file UAC asks for admin privileges. But when I run it from VS2013 (by pressing "Run" or F5) it doesn't! And if you open the same project with VS2012/VS2010, they do ask to restart under admin.
You can check this quickly:
Create console application in VS2013, add manifest and set level="requireAdministrator". Then run or press F5 (VS2013 runs the application under admin when press Ctrl-F5).
But this is not the behavior of VS2012/VS2010!
How can we get the old behavior?

更新 3:
请投票此处 或通知我另一张票.

推荐答案

您需要禁用托管进程选项才能获得 VS 重启提示.项目 + 属性,调试选项卡,取消勾选启用 Visual Studio 托管进程"复选框.立即启动 VS 提升会更容易.右键单击快捷方式,以管理员身份运行.

You need to disable the hosting process option to get the VS restart prompt. Project + Properties, Debug tab, untick the "Enable the Visual Studio hosting process" checkbox. It can be easier to just start VS elevated right away. Right-click the shortcut, Run as Administrator.

不完全确定这是错误还是功能.密切关注 此 Connect 报告 了解更多信息.

Not entirely sure if this is a bug or a feature. Keep your eye on this Connect report to learn more.

更新:看起来像是一个错误,反馈报告已被关闭为已修复".不幸的是,当该修复程序将使其成为我们的机器时,它没有给出任何提示.也许未来的 VS2013 更新,肯定是下一个版本.
更新 2:修复进入 VS2013 更新 3.

Update: looks like a bug, the feedback report was closed as "fixed". Unfortunately it gives no hint when that fix is going to make it our machines. Maybe a future VS2013 update, surely the next version.
Update2: the fix made it into VS2013 Update 3.

这篇关于在调试模式下运行应用程序时,清单不会强制 Visual Studio 2013 在管理员下重新启动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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