I am new to C # and VS, and I have a weird problem.
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.IO; namespace ExampleApplication { class Program { static void Main(string[] args) { FileInfo fi = new FileInfo("C:\\TEST.TXT"); fi.Create(); Console.WriteLine("File exists: {0}", fi.Exists); } } }
This is my program, it creates a TEST.TXT file. When I run the program inside VS 2010 using the Debug β Start Debugging (F5) command, the program works fine and the file is created.
However, if I create a solution, run the program from .exe using the cmd prompt:
C:\...\Visual Studio 2010\Projects\ExampleApplication\ExampleApplication\bin\Debug\ExampleApplication.exe
It launches the output: File exists: true . But the file was not created. Does anyone have any ideas?
thanks
source share