拒绝访问路径c:\ ... \ Project.exe [英] Access to the path c:\...\Project.exe is denied

查看:96
本文介绍了拒绝访问路径c:\ ... \ Project.exe的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个Windows安装项目.设置项目时,我必须在"Project.exe"文件中写入配置参数.从c#代码打开该文件时,我得到拒绝访问路径c:\ ... \ Project.exe". ..如何解决此权限问题?我正在使用此代码

I have a Windows setup project . I have to write the config parametrs in "Project.exe" file while setting up the project.While opening that file from c# code ,I am getting "Access to the path c:\...\Project.exe" is denied...How to solve this permission issue?I am using this code

Configuration config = ConfigurationManager.OpenExeConfiguration(filePath);           
config.AppSettings.Settings.Clear();
config.AppSettings.Settings.Add("DTD_XML_FILES_PATH", txtDTDFilesPath.Text);
if(chkLogException.Checked)
   config.AppSettings.Settings.Add("EXCEPTION_LOG_FILES_PATH", txtExceptionLogPath.Text);         
config.AppSettings.Settings.Add("DISPLAY_USER_FRIENDLY_MESSAGES", chkUserFrndMsgs.Checked.ToString());
config.Save();

推荐答案

请确保该文件尚未打开,并且您可以访问相应的文件夹.
make sure that file is not already open and that you have access to the appropriate folder.


通过写入安装程序的OnCommitted事件中的配置详细信息即可解决该错误
The error got fixed by writing the config details from the OnCommitted event of installer


这篇关于拒绝访问路径c:\ ... \ Project.exe的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆