Question about the Common Application Data Folder

  • Follow


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
0
Reply TC 11/11/2009 6:34:39 PM

On 2009-11-11, TC <golemdanube@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
0
Reply Tom 11/11/2009 7:45:09 PM


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
> .
> 
0
Reply Utf 11/11/2009 7:47:01 PM

On Nov 11, 11:45=A0am, Tom Shelton <tom_shel...@comcastXXXXXXX.net>
wrote:
> On 2009-11-11, TC <golemdan...@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
0
Reply TC 11/11/2009 8:05:29 PM

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.
0
Reply Utf 12/10/2009 10:16:01 PM

4 Replies
1298 Views

(page loaded in 0.065 seconds)

Similiar Articles:
















7/24/2012 3:47:24 PM


Reply: