简体   繁体   English

通过Wix将C#exe安装到Program Files文件夹后无法正常工作

[英]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. 我有一个C#winforms应用程序,将其安装到C:/ProgramFiles文件夹后将无法使用。 I use an MSI created with Wix to install. 我使用由Wix创建的MSI进行安装。 When either double clicking the exe or right clicking and running as admin this window pops up and then nothing happens: 双击exe或右键单击并以admin身份运行时,将弹出此窗口,然后没有任何反应:

Application Error Message: 应用程序错误消息:

在此处输入图片说明

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). 该应用程序可以在Visual Studio中运行,并且可以通过我的VS项目的bin / Debug文件夹进行访问(Debug文件夹中的exe是我用于Wix安装的exe)。

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. 安装MSI后,如果我将exe文件从C:/ProgramFiles复制到我的一个用户文件夹(例如: C:/Users/User/Desktop )中,则该exe文件可以工作。

I am guessing this is some sort of UAC/permissions issue but I cannot find any documentation to confirm that theory. 我猜这是某种UAC/permissions问题,但是我找不到任何文档来确认该理论。 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. 这是错误文本: 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). 编辑II:这个问题变得越来越混乱(令人沮丧)。 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. 它将允许我写入AppData文件夹,但不能从其中读取(从技术上讲,它不是可以正常工作吗?)...真的很感谢您的帮助。 I am reading the contents of my XML file via XDocument. 我正在通过XDocument阅读XML文件的内容。

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. 使文件不隐藏可解决访问拒绝问题,并且一切正常。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM