(报错)未将对像引用设置到对像的实例??
完整报错信息:"在DLSetupAction.DLInstaller的OnAfterInstall事件程序中发生异常.未将对像引用设置到对像的实例.
引用部分:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Configuration.Install;
using System.Runtime.InteropServices;
using Microsoft.VisualStudio.Tools.Applications.Runtime ;
using System.Windows.Forms;
using System.Text;
报错类:
private void DLInstaller_AfterInstall(object sender, InstallEventArgs e)
{
//获得Caspol工具所在的文件路径
System.Text.StringBuilder sPath = new System.Text.StringBuilder(1024);
int size = 0;
GetCORSystemDirectory(sPath, sPath.Capacity, ref size);
sPath.Append("Caspol.exe");
//获得安装程序的目标路径
string sUrl = this.Context.Parameters["targetdir"].Trim('/');
sUrl = '"' + sUrl + '"';
sUrl += "*";
//设置Caspol的命令参数
StringBuilder sPar =new StringBuilder ("-q -u -ag All_Code -url");//报错的地方就是这里报的错
sPar.Append(sUrl);
sPar.Append(" FullTrust");
sPar.Append(" -n");
sPar.Append(" myexcelapp");
//执行Caspol命令来配置权限
System.Diagnostics.Process.Start(sPath.ToString(), sPar.ToString());
}
求解了!!!!!!!!!!!!!!!!!!