views:

18

answers:

1

I have my application bin on some different drive(D:\application\bin). And in my application i do some kind of folder creations(say "Backup" folder) and in this folder i have some files and do some kind of validations. and then after these validations i delete this folder.It had been working well till now.,but now i see that during the processing the deletion of folder actually tries on "C:\WINDOWS\system32\Backup" folder and then it thows an exception as this "Backup" folder doesnt exist in C:\WINDOWS\system32.

How to use assembly code base in this scenerio?

A: 
string assemblyDir = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);

The above will give you the directory containing the executing assembly. You can use Path.Combine(assemblyDir, "relativePath") to build absolute paths that can be used as the basis for your I/O operations.

Bradley Smith