拒绝访问路径c:\ ... \ Project.exe

编程入门 行业动态 更新时间:2024-10-27 22:33:52
本文介绍了拒绝访问路径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

本文发布于:2023-11-08 02:31:15,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1568081.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:路径   Project   exe

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!