Public Class Installer1 Public Sub New() MyBase.New() 'This call is required by the Component Designer. InitializeComponent() 'Add initialization code after the call to InitializeComponent End Sub Public Overrides Sub Install(ByVal stateSaver As System.Collections.IDictionary) MyBase.Install(stateSaver) End Sub Public Overrides Sub Uninstall(ByVal savedState As System.Collections.IDictionary) MyBase.Uninstall(savedState) End Sub Protected Overrides Sub OnAfterInstall(ByVal savedState As System.Collections.IDictionary) MyBase.OnAfterInstall(savedState) Try ' Call the ESRI RegAsm utility to register the assembly classes with the ESRI component categories. Dim commonFilesPath As String = Environment.GetFolderPath(Environment.SpecialFolder.CommonProgramFiles) Dim regAsmPath As String = System.IO.Path.Combine(commonFilesPath, "ArcGIS\bin\ESRIRegAsm.exe") Dim appPath As String = System.Reflection.Assembly.GetExecutingAssembly().Location Dim args As String = String.Format("""{0}"" /p:Desktop /s", appPath) Dim startInfo As System.Diagnostics.ProcessStartInfo = New System.Diagnostics.ProcessStartInfo() startInfo.FileName = regAsmPath startInfo.Arguments = args Dim esriRegProcess As New Process esriRegProcess.StartInfo = startInfo esriRegProcess.Start() Do While Not esriRegProcess.HasExited Loop Catch ex As Exception MessageBox.Show(ex.Message, "LRMT Installer", MessageBoxButtons.OK, MessageBoxIcon.Error) End Try End Sub Protected Overrides Sub OnBeforeUninstall(ByVal savedState As System.Collections.IDictionary) MyBase.OnBeforeUninstall(savedState) Try ' Call the ESRI RegAsm utility to register the assembly classes with the ESRI component categories. Dim commonFilesPath As String = Environment.GetFolderPath(Environment.SpecialFolder.CommonProgramFiles) Dim regAsmPath As String = System.IO.Path.Combine(commonFilesPath, "ArcGIS\bin\ESRIRegAsm.exe") Dim appPath As String = System.Reflection.Assembly.GetExecutingAssembly().Location Dim args As String = String.Format("""{0}"" /p:Desktop /u /s", appPath) Dim startInfo As System.Diagnostics.ProcessStartInfo = New System.Diagnostics.ProcessStartInfo() startInfo.FileName = regAsmPath startInfo.Arguments = args Dim esriRegProcess As New Process esriRegProcess.StartInfo = startInfo esriRegProcess.Start() Do While Not esriRegProcess.HasExited Loop Catch ex As Exception MessageBox.Show(ex.Message, "LRMT Installer", MessageBoxButtons.OK, MessageBoxIcon.Error) End Try End Sub End Class
Signed in members can post, follow updates, and more. New here? Register a free account.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.