简体   繁体   English

在Visual Studio 2012中以管理员身份运行解决方案中的项目之一

[英]Run one of the projects in a solution as administrator in Visual Studio 2012

I've a Visual Studio 2012 solution that consists of two projects: MVC Web App and Windows Application. 我有一个Visual Studio 2012解决方案,其中包括两个项目:MVC Web App和Windows Application。

In the MVC Web App, users create some scheduler tasks, which are added to a database table. 在MVC Web App中,用户创建一些计划程序任务,这些任务将添加到数据库表中。 Because of security, I cannot run it as administrator (right-click VS 2012 and run as administrator). 由于安全原因,我无法以管理员身份运行它(右键单击VS 2012并以管理员身份运行)。

In order to create the scheduler tasks in the Windows Task Scheduler, I created a second project (Windows Application) in the same solution. 为了在Windows Task Scheduler中创建计划程序任务,我在相同的解决方案中创建了另一个项目(Windows应用程序)。 This app will create/update/delete scheduler tasks in the Windows Task Scheduler by getting the data from the MVC Web App. 此应用程序将通过从MVC Web应用程序获取数据来在Windows任务计划程序中创建/更新/删除计划程序任务。

Is there a way to run the second project, instead of the entire solution, as administrator? 有没有办法以管理员身份运行第二个项目而不是整个解决方案? Or do I have to create the Windows Application or Windows Service in a separate solution? 还是我必须在单独的解决方案中创建Windows应用程序或Windows服务? If so, what would be the best way to detect changes in the database table? 如果是这样,检测数据库表中更改的最佳方法是什么? SqlDependency, Change Data Capture, or something else? SqlDependency,更改数据捕获或其他?

Thanks for any pointers. 感谢您的指导。

You need to add what is called an AppManifest to the project. 您需要在项目中添加所谓的AppManifest。 You can do this by right clicking on the project and selecting the "Add New Item" option. 您可以通过右键单击项目并选择“添加新项”选项来执行此操作。 Once the pop up arrives, select the "Application Manifest File". 弹出窗口到达后,选择“应用程序清单文件”。

Once this had been added to the project you need to adjust it to have the following line 将其添加到项目后,您需要对其进行调整以使其具有以下行

<requestedExecutionLevel level="requireAdministrator" uiAccess="false" />

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 在ASP.NET中的一种解决方案下访问不同项目中的Webforms.Visual Studio 2012 - Access Webforms in different projects under one solution in Asp .net.Visual studio 2012 Visual Studio 2012:项目和解决方案资源管理器所需的帮助 - visual studio 2012: Help needed with projects and solution explorer 为解决方案中的多个 Visual Studio 2012 C# 项目启动调试器时出现 Visual Studio 2017 警告错误 - Visual Studio 2017 warning errors when starting a debugger for multiple Visual Studio 2012 C# projects in a solution 使Visual Studio 2012在一个解决方案中查找并运行x64和x86单元测试 - Make Visual Studio 2012 find and run both x64 and x86 unit tests in one solution Visual Studio 解决方案资源管理器未在解决方案中显示项目 - Visual Studio Solution Explorer not showing projects in solution 如何在Visual Studio 2012中切换(或突出显示)同一解决方案的项目? - How do i switch between (or highlight) projects of the same solution in Visual Studio 2012? 为什么以“以管理员身份运行”运行Visual Studio? - Why run Visual Studio as “Run as Administrator”? Visual Studio 2012调试多个项目 - Visual Studio 2012 Debugging multiple Projects Visual Studio 2012不构建依赖项目 - Visual Studio 2012 not building dependent projects 在Visual Studio 2012中添加对其他项目的引用 - Adding references to other projects in Visual Studio 2012
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM