Access denied to file in .Net
I am trying to copy an entire directory from one place to other through installer. Below is the mentioned Code
public static void copyDirectory(string Src, string Dst)
{
String[] Files;
if (Dst[Dst.Length - 1] != Path.DirectorySeparatorChar)
Dst += Path.DirectorySeparatorChar;
if (!Directory.Exists(Dst)) Directory.CreateDirectory(Dst);
Files = Directory.GetFileSystemEntries(Src);
foreach (string Element in Files)
{
// Sub direct开发者_如何学运维ories
if (Directory.Exists(Element))
copyDirectory(Element, Dst + Path.GetFileName(Element));
// Files in directory
else
File.Copy(Element, Dst + Path.GetFileName(Element), true);
}
}
It is giving me above error.please help me out in the above mentioned issue.
- make sure all applications that use that dll are closed.
- since you are using "installer", but is still c# code, does it use the dll file?
精彩评论