Reputation: 1815
As I searched there is a folder in windows partition named "ProgramData" that contains applications' data which is used by applications in run time. Since this folder does not need admin permission and it is common between system users it is the best place to put the runtime files. In C#.Net I reach this folder address by this code:
Application.CommonAppDataPath
The problem is that I can not find the right folder to put my data in it while I'm creating windows installer(msi file) by Visual Studio Setup Project. I want to know how can I add this folder to my setup project.
Regards.
Upvotes: 5
Views: 9284
Reputation: 1815
I found out that my question was wrong for my purpose because of the permission stuff. The solution I found is written here in stackoverflow.com and I mixed it up by the following code in my application to get address of public documents.
private static string getAddress()
{
RegistryKey rk = Registry.LocalMachine;
RegistryKey sk = rk.OpenSubKey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\explorer\\Shell Folders");
string address = "";
if (sk != null)
{
address = (string)sk.GetValue("Common Documents", @"c:\Users\Public\Documents");
}
return address;
}
Let's overview what I said and what I did, First I found out that what I wanted is wrong and ApplicationData folder is accessible just for it's creator while I wanted a folder that is shared between all Users. So I found this link and followed it, create the folder I wanted in FileSystem Explorer in my Installer Project. Then I changed my C# code and made it read the address from registry.
Upvotes: 0
Reputation: 10993
Here is how you can add it:
http://msdn.microsoft.com/en-us/library/windows/desktop/aa367992(v=vs.85).aspx
Upvotes: 7