CubaLibre
CubaLibre

Reputation: 375

WiX: Installing application in ProgramFilesFolder throws AccessDenied Exception. Why?

I have a C# application and a WiX project to install this application in the ProgramFilesFolder. My application has a viewer element that uses a dll file. If i start the application with normal user rights i get an error and the viewer element in my application does not load with the error message that my viewer element has no access to the dll file. As an admin user it works fine. In my WiX project i set the property perMachine and i have several other dll files used within my application and i dont get such error.

If i install my application outside the ProgramFilesFolder there is no problem. What should i do? In VS2010 i can set Build Action and Copy to output directory for each file, do i have to set something special? Or is there in the File element of WiX an option to set access properties?

Upvotes: 2

Views: 450

Answers (2)

Cosmin
Cosmin

Reputation: 21416

You are encountering this behavior because a part of your application (the viewer element) needs write permissions in the installation folder.

A solution is to request elevation through your application manifest. This way your application always runs with Administrator privileges.

Upvotes: 2

Alexey Ivanov
Alexey Ivanov

Reputation: 11838

Does it throw exception when installing or when using the application?

If the latter, the only guess I have is that the DLL in question tries to write something into one of the protected folders, Program Files in this case. You should eliminate that to make it work without admin privileges.

Upvotes: 1

Related Questions