1
[RunInstaller(true)]
public partial class ProjectInstaller : Installer
{
private ServiceInstaller m_serviceInstaller;
private ServiceProcessInstaller m_processInstaller;
public ProjectInstaller()
{
string Names= ConfigurationManager.AppSettings["Names"].ToString();
System.Diagnostics.Debugger.Break();
m_serviceInstaller = new System.ServiceProcess.ServiceInstaller();
m_processInstaller = new System.ServiceProcess.ServiceProcessInstaller();
//
// serviceProcessInstaller1
//
m_processInstaller.Account = System.ServiceProcess.ServiceAccount.LocalSystem;
m_processInstaller.Password = null;
m_processInstaller.Username = null;
//
// serviceInstaller1
//
m_serviceInstaller.ServiceName = "Testing" + Names;
m_serviceInstaller.DisplayName = "Testing" + Names;
m_serviceInstaller.Description = "Testing" + Names;
//
// ProjectInstaller
//
this.Installers.AddRange(new System.Configuration.Install.Installer[] {
m_processInstaller,
m_serviceInstaller});
}
}
위와 같이 프로젝트 설치 프로그램 코드를 컴파일하면 오류가 발생하지 않지만 설치를 시도하면 System.Null 참조 예외가 발생하기 때문에 롤백이됩니다. 또한 AppConfig를 아무 문제없이 두 번 확인했습니다.ConfigurationManager.AppSettings 프로젝트 설치 관리자에서 오류가 발생했습니다.
<appSettings>
<add key="Names" value="BOC" />
</appSettings>
어디서 잘못 될지 알고 있습니다.
그 설정 파일은 앱 실행 경로에 복사/출판 확인하시기 바랍니다 – LittleSweetSeas
그래,가 –