Question MSI Setup Installer - Configure path for Content Files

alexsajno

New member
Joined
Sep 28, 2021
Messages
2
Programming Experience
5-10
Hi
I have a code that serialize an object and save it on an existing file in the application folder. The problem is that the json file is saved on Program Files so it needs admin permission to update it.
I want to move the file to user application data folder (from Windows). I don't want to love the files throw the code, just configure in the setup to install the Content Files to application data folder. How can I do that ?
 

Skydiver

Staff member
Joined
Apr 6, 2019
Messages
3,762
Location
Chesapeake, VA
Programming Experience
10+
Even if you had the setup save the files into the application data folder (which is doable, but it's a setup question, not a C# question), that only happens at setup time. It still won't do anything for runtime when your program is running and it has to go find the files. For that you would need to modify your code to go look for the files in the application data folder. For that Environment.SpecialFolders and Environment.GetFolderPath() are your friends.

 

alexsajno

New member
Joined
Sep 28, 2021
Messages
2
Programming Experience
5-10
Even if you had the setup save the files into the application data folder (which is doable, but it's a setup question, not a C# question), that only happens at setup time. It still won't do anything for runtime when your program is running and it has to go find the files. For that you would need to modify your code to go look for the files in the application data folder. For that Environment.SpecialFolders and Environment.GetFolderPath() are your friends.

I know how to find the files. I need to know how to put the files there .... I could load the files to the assembly or program files and move/copy to the app data folder.
But I am using the Microsoft Visual Studio Installer Projects extension so I want to do it correctly. Any idea??
 

Skydiver

Staff member
Joined
Apr 6, 2019
Messages
3,762
Location
Chesapeake, VA
Programming Experience
10+
I'm sorry, I've never used the Visual Studio Installer Project. I started off using InstallShield, then later msidb.exe/msifiler.exe, and eventually graduated to using Wix. And that was over 10 years ago. I don't exactly know how to use the VS tool, but my understanding is that it lets you set properties on each of the artifacts. One of the properties you can set is the destination folder.
 
Top Bottom