Windowsサービス用のmsiインストールを作成しようとしています。 msiを作成する理由は、意図したユーザーができるだけ小さな介入で迅速にサービスをインストールできるようにするためです。MSIインストール中にApp.configアプリケーション設定を構成するvb.net
msiとしてインストールするサービスを取得できますが、msiがインストールされているときにユーザーが定義する必要がある変数がコード内にあります。ユーザーから要求される変数は、自分のサービスが作成するxmlファイルを作成するファイルパスです。
私は、app.configアプリケーション設定で、xmlファイルを書き込むファイルパスを含むように設定できたと考えました。しかし、私はこれを行うには苦労していると私はそれを行うための最善の方法はないかわからない?
実行可能ファイルが含まれているセットアッププロジェクトがあり、ユーザーからの1つの変数を含むテキストボックスがあります。
私のサービスインストーラとプロセスインストーラを含むインストーラクラスがあります。これは私が次に何をする必要があるかを理解するために苦労しているところです。 インストール方法を変更する必要がありますか?私のインストーラクラスの現在のコードが自動的に生成され、次のようになりました。
Imports System.Configuration.Install
Imports System.Configuration
<System.ComponentModel.RunInstaller(True)> Partial Class ProjectInstaller
Inherits System.Configuration.Install.Installer
'Installer overrides dispose to clean up the component list.
<System.Diagnostics.DebuggerNonUserCode()> _
Protected Overrides Sub Dispose(ByVal disposing As Boolean)
Try
If disposing AndAlso components IsNot Nothing Then
components.Dispose()
End If
Finally
MyBase.Dispose(disposing)
End Try
End Sub
'Required by the Component Designer
Private components As System.ComponentModel.IContainer
'NOTE: The following procedure is required by the Component Designer
'It can be modified using the Component Designer.
'Do not modify it using the code editor.
<System.Diagnostics.DebuggerStepThrough()> _
Private Sub InitializeComponent()
Me.ServiceProcessInstaller1 = New System.ServiceProcess.ServiceProcessInstaller()
Me.ServiceInstaller1 = New System.ServiceProcess.ServiceInstaller()
'
'ServiceProcessInstaller1
'
Me.ServiceProcessInstaller1.Account = System.ServiceProcess.ServiceAccount.LocalSystem
Me.ServiceProcessInstaller1.Password = Nothing
Me.ServiceProcessInstaller1.Username = Nothing
'
'ServiceInstaller1
'
Me.ServiceInstaller1.ServiceName = "Spotter"
Me.ServiceInstaller1.StartType = System.ServiceProcess.ServiceStartMode.Automatic
'
'ProjectInstaller
'
Me.Installers.AddRange(New System.Configuration.Install.Installer() {Me.ServiceProcessInstaller1, Me.ServiceInstaller1})
End Sub
Friend WithEvents ServiceProcessInstaller1 As System.ServiceProcess.ServiceProcessInstaller
Friend WithEvents ServiceInstaller1 As System.ServiceProcess.ServiceInstaller
End Class
私もCustomActionData値を追加することができます。文字列は、入力されたユーザ値を収集するために使用したコンテキストオブジェクトに何が渡されるかを決定します。 param1は私の変数名です。
私はかなりインストーラコードに苦しんでいます...私は思いますか?
応答いただきありがとうございます。あなたの例を読んで、それを完全に理解するのに苦労しています。変数Me.XMLDirとは何ですか? – Simon
変数は、customdataで渡された値を抽出することを示しています。これはapp.configの更新に使用するものです。 –