zrubi zrubi - 5 months ago 56
C# Question

Directory path for executable

Hello I’m trying create directory file with text document inside my first windows form application executable, but something is wrong here:

I want make it available with exe file for other local user computers:

string dir = @"C:\Users\Public\AppData\Roaming\AppFolder\document.txt";
if (!Directory.Exists(dir))
var stream = File.CreateText(dir);

but I got this:

An unhandled exception of type 'System.IO.IOException' occurred in

Additional information: The process cannot access the file
because it is being used by another process.


I guess you need to issue the commands for the stream to be accessible anywhere else