使用 VS2008 构建 MSI/安装程序 - 如何为日志和临时文件创建子文件夹

发布于 2024-09-28 22:40:03 字数 542 浏览 1 评论 0原文

我构建了一个 C#.NET WinForms 应用程序。我现在需要为此构建一个 MSI 安装程序,以便我可以将其发送给我的客户。

我被困在以下地方。

  1. 我使用 log4net 进行日志记录。如何编写 App.Config,使 LogFile 文件夹基于最终用户安装应用程序的位置。也就是说,如果我的最终用户将其安装在默认位置 C:\Program Files\\,则 LogFile 文件夹将为 C:\Program Files\\*LogFiles*。

如果他们选择将其安装在其他位置,则 LogFiles 文件夹将是 MyApp 文件夹的子文件夹。

  1. 同样,我有一个 TemporaryFiles 文件夹,在修改原始文件时在其中存储临时文件。这又应该是 MyApp 文件夹的子文件夹。

我还了解到应用程序文件夹指向[ProgramFilesFolder][Manufacturer][ProductName],CommonFiles文件夹指向哪里?通常里面装的是什么?

我使用 VS2008 来构建设置。

I have built a C#.NET WinForms App. I now need to build a MSI installer for the same so that I can ship it to my clients.

I am stuck at the following place.

  1. I use log4net for Logging. How do I write my App.Config in such a way that the LogFile folder is based on where my end user installs the Application. That is, if my end user installs it on the Default Location of C:\Program Files\\, then the LogFile folder will be C:\Program Files\\*LogFiles*.

If they chose to install it elsewhere, the LogFiles folder will be a sub-folder of the MyApp folder.

  1. Similarly, I have a TemporaryFiles Folder where I store the temporary files while I am modifying the original files. This again should be a sub-folder of the MyApp Folder.

I also understand that the Application Folder points to the [ProgramFilesFolder][Manufacturer][ProductName], where does the CommonFiles folder point to? And typically what goes inside that?

I use VS2008 for Building the Setup.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

枫以 2024-10-05 22:40:03

我根本就没有程序文件文件夹中的日志文件。该进程需要对其具有写入权限,通常您只希望管理员对程序文件文件夹或其任何子文件夹具有写入权限。我宁愿考虑使用例如 %appdata%/yourapplication/logfiles。然后,您可以轻松地将 log4net 配置指向该位置,无论在何处设置。我会对临时文件做同样的事情。

(我没有 CommonFiles 问题的答案。)

I would simply not have the log files in the program files folder. The process needs write permissions on it and generally you would only want administrators to have write permissions on the program files folder or any of its subfolders. I would rather consider using e.g. %appdata%/yourapplication/logfiles. Then you could easily have your log4net config point to that location, regardless of where this will be set up. I would do the same thing for the temporary files.

(I don't have an answer to that CommonFiles question.)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文