Remove Administrator Permission Required From .NET Project


When you create a .NET project, if you opened the Visual Studio as Administrator and created a project, The next time if you forget to open Visual Studio as Administrator, you will see the following pop windows to ask you restart Visual Studio under different credentials when you try to run your application:


Normally after you restart Visual Studio as administrator you will be able to run the application.

However, sometimes you might want to change this limitation, you do not want to limit your application for Administrator role. you want to remove the Administrator permission required from this .net project. how can we do ?

1: If you start Visual Studio as a common user account but not Administrator, the first error message which you can see might be similar with the following:

Could not write lines to file "obj\x86\Debug\WindowsFormsApplication2.csproj.FileListAbsolute.txt". Access to the path 'D:\Tony\TestCode\WindowsFormsApplication2\WindowsFormsApplication2\obj\x86\Debug\WindowsFormsApplication2.csproj.FileListAbsolute.txt' is denied.

To resolve this error is simple, just delete the obj folder and bin folder under current project, and rebuild the project;

2: In some cases you will see the popup windows which we mentioned at the beginning of this article, it asks you restart Visual Studio as Administrator.

The reason is that in your project there is a app.manifest file:


there are security settings in app.manfest file.

Please see the below security settings sample, we can see the line in bold, it indicates the project’s execution level needs Administrator permission, that is why we saw the popup windows which we mentioned at the beginning in this article:

<trustInfo xmlns="urn:schemas-microsoft-com:asm.v2"> 
    <requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3"> 
      <!– UAC Manifest Options 
          If you want to change the Windows User Account Control level replace the 
          requestedExecutionLevel node with one of the following.

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

          Specifying requestedExecutionLevel node will disable file and registry virtualization. 
          If you want to utilize File and Registry Virtualization for backward 
          compatibility then delete the requestedExecutionLevel node. 
      <!–<requestedExecutionLevel level="asInvoker" uiAccess="false" />–> 
     <requestedExecutionLevel level="requireAdministrator" uiAccess="false" /> 
      <defaultAssemblyRequest permissionSetReference="Custom" /> 
      <PermissionSet class="System.Security.PermissionSet" version="1" ID="Custom" SameSite="site" Unrestricted="true" /> 

So if you do not want to limit to Administrator permission, just simply remove or comment the line in bold shown above.

3: In some other cases, you might manually change permissions for some sub-folder of your project. this step is a Windows operations, we do not give detail information here.