Creating Setup and Deployment Projects in VS2005.NET

     最近我们团队完成了项目开发,要我做一个安装程序.以前从来没有进行过,哈哈^先花了半天学习,最后做了一个安装程序.但是出现在了一个问题,希望能得到高手的指教:
在我安装在最后的关头出现了这样的错误:未将对象设置引用到对象的实例!


安装程序又无法进行调试,找了好多次还是找不到哪里出现了问题.后面附上了安装类库的代码:
我的解决方案:


UI设计(1):


UI设计(2):


类库的代码有点长:
using System;
using System.IO;
using System.Data;
using System.Configuration.Install;
using System.DirectoryServices;
using System.Reflection;
using System.Data.SqlClient;
using System.Collections.Specialized;
using System.Xml;
using Microsoft.Win32;
using System.ComponentModel;
using System.Management;
using System.Collections;

namespace EightySharplibary
{
    [RunInstaller(
true)]
    
public partial class EightySharpInstaller : Installer
    
{
        
private SqlConnection sqlConn = null;
        
private SqlCommand Command;
        
private static string DBName;
        
private string AnotherDB;
        
private string ServerName;
        
private string AdminName;
        
private string AdminPwd;
        
private string iis;
        
private string port;
        
private string dir;
        
private string _target;
        
private DirectoryEntry _iisServer;
        
private ManagementScope _scope;
        
private ConnectionOptions _connection;

        
public EightySharpInstaller()
        
{
            InitializeComponent();
        }

        
//connect the db.
        ConnectionDatabase
        
//Get the db file 
        GetSQLFiles
        
//ExecuteSQL statement
        Execute sql statement.
        
//Create database and attach the files.
        Create DB and attach the file.
        
RestoreDB Backup the data from the files .bak.
        
//Modify the web.config 
        Modify teh web.config connectionstring.
        
//Write the registrykey
        Write RegistryKey.
        
//Connect the iis server
        Connect iis server
        
//Is Web site Exists
        Is web site exists

        
//get next serverid
        Get next openID
        
//create web site
        Create Web site
        
//Install
        Install
        
Uninstall did not complete
    }

}


希望高手指点迷津.
感谢
(徐智雄):http://www.cnblogs.com/xuzhixiong/archive/2006/06/27/437056.html
http://weblogs.asp.net/scottgu/archive/2005/11/06/429723.aspx
http://www.c-sharpcorner.com/UploadFile/vishnuprasad2005/SetupProjects12022005022406AM/SetupProjects.aspx
SetupProjects12022005022406AM/SetupProjects.aspx

作者:SCPlatform
Email:SCPlatform@outlook.com
本文旨在学习、交流使用,任何对文章内容的出版、印刷,对文章中提到的技术的商业使用时,请注意可能存在的法律风险。

原文地址:https://www.cnblogs.com/SCPlatform/p/973965.html