Jump to content


This is a ready-only archive of the InstallSite Forum. You cannot post any new content here. / Dies ist ein Archiv des InstallSite Forums. Hier können keine neuen Beiträge veröffentlicht werden.
Photo

Translating VBScript to CA


2 replies to this topic

sprinterslane

sprinterslane
  • Full Members
  • 2 posts

Posted 08 February 2012 - 20:28

Hi Folks,

I am trying to make a VBscript work in a Custom Action in IS 2012, but I do not know how to translate my VB code to a VB custom action. For example, this works in VB Script:

Imports System.Xml
Module Module1
Sub Main()
Dim reader As XmlTextReader = New XmlTextReader("install.xml")
Do While (reader.Read())
Select Case reader.NodeType
Case XmlNodeType.Text 'Display the text in each element.
Console.WriteLine(reader.Value)
End Select
Loop
End Sub

The 'Imports' causes a crash in my custom action, and I have no idea where to start. How would I write this same code in a VBScript for a custom action? I already know how to create the WshShell Object correctly and how to use the Session.Object, but I need hand holding.

Thanks,

SL

akerl

akerl
  • Full Members
  • 104 posts

Posted 13 February 2012 - 14:43

MSI speaks native VBScript, only (http://msdn.microsof...73zc69c(v=VS.85).aspx). Your code is VB.NET code. You can't use VB.NET code as a VBScript CA in MSI. Use your code as an EXE CA.

Andreas Kerl

Inside Windows Installer 4.5
ISBN 3-86645-431-7


sprinterslane

sprinterslane
  • Full Members
  • 2 posts

Posted 13 February 2012 - 18:34

Hi,

I figured it out ... Never us VB script. Make 'managed assembly' using a VB class or C# class. 'Managed Assembly' is the correct term for a .NET .DLL ... Thanks