1. 执行权限

  对于一般服务项目,需要使用管理员权限打开Visual Studio。右击项目 -> 属性 -> 安全性,如下图:

  勾选红框中部分,项目中会增加文件 app.mainfest 如下图:

  该文件内容:  

<?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">
<!-- UAC 清单选项
如果要更改 Windows 用户帐户控制级别,请用以下节点之一替换
requestedExecutionLevel 节点。 <requestedExecutionLevel level="asInvoker" uiAccess="false" />
<requestedExecutionLevel level="requireAdministrator" uiAccess="false" />
<requestedExecutionLevel level="highestAvailable" uiAccess="false" /> 指定 requestedExecutionLevel 节点将会禁用文件和注册表虚拟化。
如果要利用文件和注册表虚拟化实现向后
兼容性,则删除 requestedExecutionLevel 节点。
-->
<requestedExecutionLevel level="requireAdministrator" uiAccess="false" />
</requestedPrivileges>
<applicationRequestMinimum>
<defaultAssemblyRequest permissionSetReference="Custom" />
<PermissionSet class="System.Security.PermissionSet" version="" Unrestricted="true" ID="Custom" SameSite="site" />
</applicationRequestMinimum>
</security>
</trustInfo>
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
<application>
<!-- 此应用程序设计使用的所有 Windows 版本的列表。
Windows 将会自动选择最兼容的环境。-->
<!-- 如果应用程序设计为使用 Windows Vista,请取消注释以下 supportedOS 节点-->
<!--<supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}"></supportedOS>-->
<!-- 如果应用程序设计使用 Windows ,请取消注释以下 supportedOS 节点-->
<!--<supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}"/>-->
<!-- 如果应用程序设计为使用 Windows ,请取消注释以下 supportedOS 节点-->
<!--<supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}"></supportedOS>-->
<!-- 如果应用程序设计为使用 Windows 8.1,请取消对以下 supportedOS 节点的注释-->
<!--<supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}"/>-->
</application>
</compatibility>
<!-- 启用 Windows 公共控件和对话框的主题(Windows XP 和更高版本) -->
<!-- <dependency>
<dependentAssembly>
<assemblyIdentity
type="win32"
name="Microsoft.Windows.Common-Controls"
version="6.0.0.0"
processorArchitecture="*"
publicKeyToken="6595b64144ccf1df"
language="*"
/>
</dependentAssembly>
</dependency>-->
</asmv1:assembly>

  当编译或启动项目时,如果权限不足,会有提示是否以管理员身份运行 Visual Studio,选择是后自动重新以管理员身份运行 Visual Studio 。

2.

最新文章

  1. FragmentTabHost简单保存状态的方法
  2. navicat 破解
  3. ORA-22868: 具有 LOB 的表包含有位于不同表空间的段
  4. VSS迁移备忘
  5. Android 内存分析工具 - LogCat GC
  6. 24种设计模式--责任链模式【Chain ofResponsibility Pattern】
  7. POJ2104-- K-th Number(主席树静态区间第k大)
  8. juce中的timer
  9. 总结自己的Git常用命令
  10. Ext.override
  11. Dynamics 365-如何下载新版本的Tools
  12. PyCharm远程开发和调试
  13. Ubuntu中MySql的启动与关闭
  14. 网络流(四)dinic算法
  15. laravel 数据库 - 增删查改
  16. Eclipse中导入外部jar包步骤
  17. Both - Either - Neither English Grammar
  18. JAVA list集合两种去重方法
  19. Phpcms之L()函数
  20. 用ansible剧本搭建lnmp

热门文章

  1. Java简单操作Zookeeper
  2. OOP的五大原则
  3. vue踩坑(二):跨域以及携带cookie
  4. Makefile 命令解析
  5. 从零开始学spring cloud(三) -------- Eureka简介
  6. Laravel 5 速查表
  7. leetcode 字谜
  8. django xadmin查找当前用户所在组
  9. mysql中文查询问题
  10. windows下Docker的安装