Deploy applications in Run as Administrator mode in Windows using Visual Studio and Inno Setup

Add the following line in your [Setup] section. This is the primary way to indicate that your installer requires administrative rights.

[Setup]
...
PrivilegesRequired=admin
...

Consider embedding an appropriate manifest into your application’s executable to have it automatically request elevation when executed outside the installer. This can provide a more seamless experience for the user.

1. Create the Manifest File:

  • Right-click on your project in the Solution Explorer and select Add -> New Item….
  • Choose Application Manifest File (it might be under the General category).
  • The default name is typically app.manifest. Keep this name or adjust it if necessary.

2. Modify the Manifest:

  • Open the newly created app.manifest file. The default content will be similar to this:

<?xml version="1.0" encoding="utf-8"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0" xmlns:asmv3="urn:schemas-microsoft-com:asm.v3">
  <assemblyIdentity version="1.0.0.0" name="MyApplication.app"/>
  <trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
    <security>
      <requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v1">
        </requestedPrivileges>
    </security>
  </trustInfo>
</assembly>
  • Inside the <requestedPrivileges> element, add the following line:
<requestedExecutionLevel  level="requireAdministrator" uiAccess="false" />

3. Embed the Manifest:

The manifest is now created, but you need to tell Visual Studio to embed it into your executable:

  • Right-click on your project and select Properties.
  • Go to the Application tab.
  • Under Manifest, select Embed manifest with default settings.

Build the Project:

Rebuild your project. The generated executable will now have the UAC manifest embedded, causing your application to request administrative privileges when run.

Problem in installing Dot Net Core 1.0.0 VS 2015 Tools Preview 2

Each time I try to install the DotNetCore.1.0.0-VS2015Tools.Preview2.exe package I get an error saying the following:

Setup Failed One or more issues caused the setup to fail. Please fix the issues and then retry setup. For more information see the log file. Setup has detected that Visual Studio 2015 Update 3 may not be completely installed. Please repair Visual Studio 2015 Update 3, then install this product again.

After changing the VS Community UpdateVersion string value from 14.0.25424 to 14.0.25420 in the registry, the installer worked fine for me

HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\DevDiv\vs\Servicing\14.0\community
HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\DevDiv\vs\Servicing\14.0\community\1033
HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\DevDiv\vs\Servicing\14.0\ente‌rprise
HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\DevDiv\vs\Servicing\14.0\ente‌rprise\1033

References :
http://stackoverflow.com/questions/38134048/problems-installing-dot-net-core-1-0-0-vs-2015-tools-preview-2