ClickOnce Installation - Finding 'data' directory

J

jd

Hi, we're trying to get to grips with using ClickOnce installers and
are having some problems. Once installed, the majority of the
application will reside in the following directory:

C:\Documents and Settings\<username>\Local Settings\Apps\2.0\<x>\<y>
\<z>

where <x>, <y> and <z> are seamingly random strings. The installation
also keeps some files in a 'data' directory:

C:\Documents and Settings\<username>\Local Settings\Apps\2.0\Data\<x>
\<y>\<z>\Data

where <x>, <y> and <z> are again, seamingly random strings, which
differ to the path to the executable.

Whilst it is possible to get the first path relatively easily from
looking up the current directory, I've not found a way to obtain the
path to the 'data' folder.

Whilst searching I found one recommendation which claimed one could
use the following:

(string)AppDomain.CurrentDomain.GetData("DataDirectory")

However, this always appears to return null.

Can anyone shed any light on how one can obtain the data directory
path?

Many thanks in advance.

JD
 
M

Mel

I use this with ClickOnce

using System.Deployment.Application;


public static string GetDataDirectory()
{
if (ApplicationDeployment.IsNotworkDeployed)
{
return ApplicationDeployment.CurrentDeployment.DataDirectory;
}
else
Application.StartupPath;
}
 

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