想实现这样的安装程序:
安装的时候,将安装包中的一个目录及此目录下的所有内容拷贝到C盘根目录中
请问该如何实现?

解决方案 »

  1.   

    沒錯,利用.NET自帶的安裝部署程序就可以。
      

  2.   

    用DirectoryInfo类吧using System;
    using System.IO;public class MoveToTest 
    {
        public static void Main() 
        {        // Make a reference to a directory.
            DirectoryInfo di = new DirectoryInfo("TempDir");        // Create the directory only if it does not already exist.
            if (di.Exists == false)
                di.Create();        // Create a subdirectory in the directory just created.
            DirectoryInfo dis = di.CreateSubdirectory("SubDir");        // Move the main directory. Note that the contents move with the directory.
            if (Directory.Exists("NewTempDir") == false)
                di.MoveTo("NewTempDir");        try 
            {
                // Attempt to delete the subdirectory. Note that because it has been
                // moved, an exception is thrown.
                dis.Delete(true);
            } 
            catch (Exception) 
            {
                // Handle this exception in some way, such as with the following code:
                // Console.WriteLine("That directory does not exist.");
            }        // Point the DirectoryInfo reference to the new directory.
            //di = new DirectoryInfo("NewTempDir");        // Delete the directory.
            //di.Delete(true);
        }
    }
      

  3.   

    添加一个安装操作类,然后在Install方法里面用上面的代码