Question about the Common Application Data Folder

T

TC

I'm confused about how to use the CommonAppData Folder in Visual
Studio.

I need for my deployment project to put some files on the disk. Then,
my application needs to find those files.

I can use the deployment project to put files into
[CommonAppDataFolder]\[Manufacturer]\[ProductName], or any variation
on that. However, I can't figure out how to reference that folder from
within the code.

Conversely, I can use Application.CommonAppDataPath to find files in
[CommonAppDataPath]\[CompanyName]\[ProductName]\[ProductVersion].
However, I can't figure out how to make the deployment project put
files into that folder.

My impression is that the people who designed deployment projects
weren't cooperating with the people who designed the System object
model. Or am I missing something obvious?


-TC
 
T

Tom Shelton

I'm confused about how to use the CommonAppData Folder in Visual
Studio.

I need for my deployment project to put some files on the disk. Then,
my application needs to find those files.

I can use the deployment project to put files into
[CommonAppDataFolder]\[Manufacturer]\[ProductName], or any variation
on that. However, I can't figure out how to reference that folder from
within the code.

Conversely, I can use Application.CommonAppDataPath to find files in
[CommonAppDataPath]\[CompanyName]\[ProductName]\[ProductVersion].
However, I can't figure out how to make the deployment project put
files into that folder.

My impression is that the people who designed deployment projects
weren't cooperating with the people who designed the System object
model. Or am I missing something obvious?


-TC

I think you want to take a look at System.Environment.GetFolderPath and
System.IO.Path.Combine.
 
T

TC

I'm confused about how to use the CommonAppData Folder in Visual
Studio.
I need for my deployment project to put some files on the disk. Then,
my application needs to find those files.
I can use the deployment project to put files into
[CommonAppDataFolder]\[Manufacturer]\[ProductName], or any variation
on that. However, I can't figure out how to reference that folder from
within the code.
Conversely, I can use Application.CommonAppDataPath to find files in
[CommonAppDataPath]\[CompanyName]\[ProductName]\[ProductVersion].
However, I can't figure out how to make the deployment project put
files into that folder.
My impression is that the people who designed deployment projects
weren't cooperating with the people who designed the System object
model. Or am I missing something obvious?

I think you want to take a look at System.Environment.GetFolderPath and
System.IO.Path.Combine.

Tom and David,

Thanks for the advice. That's exactly what I needed. I've structured
my application to ignore the path suggested by
Application.CommonAppDataPath, and instead I'm using a custom path
based on Environment.GetFolderPath
(SpecialFolder.CommonApplicationData).

-TC
 
P

Phil

I have the exact same problem as the original question:

How can I modify my Visual Studio-generated MSI installer to install files
to the Application.CommonAppDataPath directory? There doesn't seem to be a
way to do that using the VSPROJ's File System Editor dialog.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top