开发者

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.


  1. make sure all applications that use that dll are closed.
  2. since you are using "installer", but is still c# code, does it use the dll file?
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜