Writing to AppData from a Setup & Deployment Project

时光怂恿深爱的人放手 提交于 2019-12-01 03:08:00

问题


I am updating an existing application that is installed via a Setup and Deployment Project.

The old application copied a config and a database file into the application's folder in Program Files during installation. This worked fine on Win 2000 and Win Xp (under a local admin account). In Windows 7, however, not only is this frowned upon, but it essentially doesn't work due to UAC.

So I want to update the application to write its config/data in CommonApplicationData. In the existing Setup and Deployment project, you can easily select some locations as targets for copying files. i.e. Application Folder, User's Desktop, & User's Program Files.

I do not see an analogous means of telling the Setup program to copy to the AppData / CommonApplicationData folders. Does that exist, and if not, are there any simple fixes?

Thanks!


回答1:


Do a Right Click | Add Special Folder | Custom Folder and name it anything you want ( Common Application Data Folder would be good )

In the folder properties grid, change the DefaultLocation attribute to [CommonAppDataFolder].

Add a file to the folder, build and install. You should find your file in C:\ProgramData on Windows 7.

Be advised, I highly reccomend other tools such as InstallShield and WiX over Visual Studio Deployment Projects. The tool is very limited in what it can do and you will eventually hit a brick wall.



来源:https://stackoverflow.com/questions/3562151/writing-to-appdata-from-a-setup-deployment-project

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!