Subject | Re: PROGRAMDATA Error while trying to write to file |
---|---|
Author | Peter Morris |
Post date | 2008-02-20T18:27:11Z |
>I solved a similar problem installingHmm, that's something I could do out of pure desperation I suppose,
> application and database (an
> Access file) in C:\MyCompany\MyApp.
but I really wouldn't be happy with it. I'd like my database
installed in the "proper" place!
The user running my application does have permission to write to the
folder in question as the following code reveals...
static void Main(string[] args)
{
string fileName =
Environment.GetFolderPath(System.Environment.SpecialFolder.CommonApplicationData);
fileName = Path.Combine(fileName, "MyTest.txt");
Console.WriteLine("Writing to " + fileName);
StreamWriter sw = new StreamWriter(fileName);
using (sw)
sw.WriteLine("Hello");
Console.WriteLine("Done");
Console.ReadLine();
}
Works perfectly, so the problem must lie in the embedded DLL. Can
anyone shed any light on this?
Thanks
Pete