I created an installer project for a C# desktop app I created. When I install the app I have to run the setup.exe file as administrator in order for it to install in the correct directory. If I do not run it as administrator it installs the app in the root directory. What do i need to do so I do not have to run as administrator?
Thanks,
Brian

Jay PankhaniyaPosted Jul 24, 2023, 6:10 AM
There might the one of the reasons for the following:
1: Directory Access Restricted: The directory you have selected to install the files might have only admin access. So, select the directory which is not restricted from the current user or allows the necessary rights to read and write to the current user.
2: Use relative paths and user-specific: The path might not be found by the folder on a code level or there might be some issue in the spelling. So, use the relative path to the current directory or in a reference of the root.
3: Use manifest files: Ensure your application has an appropriate manifest file that indicates whether elevation is required. You can use a
requireAdministratormanifest to request elevation when the app is launched, but this should be used sparingly and only when necessary.