Search code examples
c#windows-installeruacwix3.11

C# exe not working once installed to program files folder via Wix


I have a C# winforms application which will not work once installed to the C:/ProgramFiles folder. I use an MSI created with Wix to install. When either double clicking the exe or right clicking and running as admin this window pops up and then nothing happens:

Application Error Message:

enter image description here

The application works in Visual Studio and when accessed via the bin/Debug folder of my VS project (the exe in the Debug folder is the one I am using for the Wix install).

After the MSI installs, if I copy the exe out of C:/ProgramFiles to one of my user folders (ex: C:/Users/User/Desktop) the exe works.

I am guessing this is some sort of UAC/permissions issue but I cannot find any documentation to confirm that theory. Any direction would be much appreciated.

EDIT: Looking at the error log it is denying me access to my config file. Here is the error text: Access to the path 'C:\Users\*username*\AppData\Roaming\Leer Copy\leerConfig.xml' is denied.

EDIT II: This problem is getting more confusing (and frustrating). It will allow me to write to the AppData folder but not read from it (shouldn't it technically behave the other way around?)... Would really appreciate some help. I am reading the contents of my XML file via XDocument.


Solution

  • Originally had hid the config file so people do not mess with it/accidentally delete it. Making the file not hidden fixed the access denial and everything works how it should now.