From: TC on
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
From: Tom Shelton on
On 2009-11-11, TC <golemdanube(a)yahoo.com> wrote:
> 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.

--
Tom Shelton
From: dotNetDave on
Have you tried using this:

My.Computer.FileSystem.SpecialDirectories.CurrentUserApplicationData

David

======================================
David McCarter [Microsoft MVP]
www.dotNetTips.com
David McCarter''''s .NET Coding Standards available at:
http://codingstandards.notlong.com


"TC" wrote:

> 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
> .
>
From: TC on
On Nov 11, 11:45 am, Tom Shelton <tom_shel...(a)comcastXXXXXXX.net>
wrote:
> On 2009-11-11, TC <golemdan...(a)yahoo.com> wrote:
>
>
>
> > 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.
>
> --
> Tom Shelton

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
From: Phil on
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.