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

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

问题描述

这在 VS2010 VS2012 中起作用.但是在 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>

我尝试使用google尝试生成新的清单,从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>

Update2:
Okey这里是一个简单的示例:运行编译的.exe文件时,UAC会要求管理员特权.但是,当我从 VS2013 运行它时(通过按运行"或 F5 ),它就没有了!如果您使用 VS2012/VS2010 打开相同的项目,他们确实会要求在admin下重新启动.
您可以快速检查以下内容:
VS2013 中创建控制台应用程序,添加清单并设置 level ="requireAdministrator" .然后运行或按 F5 键(当按 Ctrl-F5 键时, VS2013 将在admin下运行该应用程序).
但这不是 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?

Update3:
请投票

Update3:
Please vote here or inform me about another ticket.

推荐答案

您需要禁用托管进程选项以获取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.

不确定是错误还是功能.请随时注意

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

更新:看起来像个错误,反馈报告已关闭为已修复".不幸的是,它没有给出何时将该修补程序制作成我们的机器的提示.也许是VS2013的未来更新,肯定是下一版本.
Update2:该修复程序将其纳入VS2013 Update 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天全站免登陆