简体   繁体   English

如何将文件放入安装项目中用户的本地应用程序数据文件夹中?

[英]How can I put files in the user's local application data folder in a setup project?

I'm working with a visual studio 2008 - You get access to a number of special folders to use if you want to include files within. 我正在使用Visual Studio 2008-如果要在其中包含文件,则可以访问许多特殊文件夹。 One I don't see on the list is the user's local application data folder. 我在列表中没有看到的一个是用户的本地应用程序数据文件夹。 Is there anyway to put files in that folder from within a VS2008 setup project? 无论如何,是否可以将文件从VS2008安装项目中放入该文件夹中?

When I was facing similar challenge, I made it so: 当我面临类似的挑战时,我做到了:

  • Created a class library auxiliary project. 创建了一个类库辅助项目。

  • Added the System.Configuration.Install.dll reference. 添加了System.Configuration.Install.dll参考。

  • Added a new class inheriting from System.Configuration.Install.Installer 添加了一个新类,继承自System.Configuration.Install.Installer

  • Wrote an override of the Install method to copy the files 写了Install方法的替代来复制文件

In the Setup project, targeted the above mentioned project output to the Application folder and - 在安装项目中,将上述项目输出定向到“应用程序”文件夹,然后-

In Custom actions (Install group) picked the auxiliary project output from the Application folder. 在“自定义操作”(“安装”组)中,从“应用程序”文件夹中选择了辅助项目输出。

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

相关问题 如何将文件复制到Visual Studio安装程序项目中的用户设置文件夹中 - How to copy files to the User's setting folder in the Visual studio Setup project 如何获取当前用户的“Application Data”文件夹的路径? - How can i get the path of the current user's “Application Data” folder? 如何访问 WPF 项目中的本地文件夹以加载和存储文件? - How can I access a local folder inside a WPF project to load and store files? 如何从应用程序访问“我的用户”文件夹中的文件? - How can I access files inside My User folder from the application? 如何在 Web 安装项目中创建新的应用程序池? - How can I create a new application pool in a Web Setup Project? 如何从 Xamarin.Forms 项目中的本地应用程序文件夹中检索文件列表? - How to retrieve list of files from the local application folder which is in Xamarin.Forms project? 如何将文件保存到我的Project文件夹c# - How can I save files to my Project folder c# 如何将解决方案文件夹文件添加到VS项目模板? - How can I add Solution Folder files to a VS Project Template? 如何将图像文件保存在项目文件夹中? - How can I save Image files in in my project folder? 文件夹和文件未添加到“用户的应用程序数据”文件夹中 - Folder and file not added to User's Application Data folder
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM