nico drapier - 2012-01-18

Hi all,

In visual studio 2005 I create an install project to install my software. I
also would like to install miktex after my software is installed correctly,
therefor I created an custom actions which is executed after my software is
installed. I do some custom actions. On of them is to install and register
extra packages. I used the SDK but encountered an error. could somebody verify
my code bellow, maybe I forgot someting, or I didn't use the correct syntax
from the miktex sdk
my code :

Private Sub Result_AfterInstall(ByVal sender As Object, ByVal e As
System.Configuration.Install.InstallEventArgs) Handles Me.AfterInstall
Dim style As MsgBoxStyle
style = MsgBoxStyle.YesNo Or MsgBoxStyle.MsgBoxSetForeground

Dim answer As MsgBoxResult = MsgBox("Install Miktex 2.8 to " +
Me.Context.Parameters.Item("tmpFolder"), style, "Miktex installation")
If (answer = MsgBoxResult.Yes) Then
Dim psi As New System.Diagnostics.Process()
psi.StartInfo.FileName = Me.Context.Parameters.Item("tmpFolder") +
"\setup-2.8.3553.exe"
psi.Start()
psi.WaitForExit()
Dim miktexInfo As New MiKTeXSetupInfo()
Dim miktexPackage As New PackageManager2_8()
MsgBox(miktexInfo.installRoot)

My.Computer.FileSystem.CreateDirectory(miktexInfo.installRoot +
"\fonts\source\public\mathabx")
My.Computer.FileSystem.CreateDirectory(miktexInfo.installRoot +
"\tex\generic\misc\mathabx")
My.Computer.FileSystem.CopyDirectory(
Me.Context.Parameters.Item("tmpFolder") + "\mathabx\source",
miktexInfo.installRoot + "\fonts\source\public\mathabx")
My.Computer.FileSystem.CopyDirectory(

Me.Context.Parameters.Item("tmpFolder") + "\mathabx\texinputs",
miktexInfo.installRoot + "\tex\generic\misc\mathabx")
miktexPackage.CreateInstaller.UpdateDb()

Else
Dim result As MsgBoxResult = MsgBox("Don't forget to install Miktex
afterwards")
If (result = MsgBoxResult.Ok) Then
Me.Dispose()
End If
End If
End Sub