C# - Start/Debug App as Administrator

  1. Right Click your Project and Add New Item...
  2. Add New Item to your Solution.
  3. Add new AppManifest file.
  4. Edit the AppManifest line <requestedExecutionLevel />
  5. Set it to level="requireAdministrator" uiAccess="false"
  6. Debug your Application and it should prompt you to run Visual Studio 2017 as administrator first.

Small note about NetCore, apparently it does it silently. There is no prompt saying you need to restart Visual Studio 2017 but it runs under regular permission/impersonation. You can run as administrator just restart your Visual Studio 2017 in Administrator mode first and it will elevate your NetCore application.