cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
iwesley
Level 4

Automation help needed ...

Hi Folks,

I've got a .dll that works great, I pass in properties and it does VB stuff, and returns values if needed in IS 2012. Now, I'm stepping it up to trying to use the automation interface to create a shortcut - or do anything simple.

So, I wrote an VB .NET EXE with the following code and it crashes ... Any suggestions?


Here's the code ... What am I doing wrong?

Dim oProject
oProject = CreateObject("ISWiAuto18.ISWiProject")

'Set file location
oProject.OpenProject("C:\temp\DISK1\BASIC_TEST_2.msi")
oProject.CloseProject()


Here is the error from the debugger ...

System.Runtime.InteropServices.COMException was unhandled
ErrorCode=-2146827188
Message=Unable to open file: C:\temp\DISK1\BASIC_TEST_2.msi. : Please make sure that the file is a valid InstallShield Developer project.
Source=ISWiAutomation.ISWiFeature.OpenProject
StackTrace:
at Microsoft.VisualBasic.CompilerServices.LateBinding.InternalLateCall(Object o, Type objType, String name, Object[] args, String[] paramnames, Boolean[] CopyBack, Boolean IgnoreReturn)
at Microsoft.VisualBasic.CompilerServices.NewLateBinding.LateCall(Object Instance, Type Type, String MemberName, Object[] Arguments, String[] ArgumentNames, Type[] TypeArguments, Boolean[] CopyBack, Boolean IgnoreReturn)
at TheTest.Form1.Button1_Click(Object sender, EventArgs e) in C:\Documents and Settings\test\My Documents\Visual Studio 2010\Projects\TheTest\TheTest\Form1.vb:line 18
at System.Windows.Forms.Control.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ButtonBase.WndProc(Message& m)
at System.Windows.Forms.Button.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentID, Int32 reason, Int32 pvLoopData)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.OnRun()
at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.DoApplicationModel()
at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.Run(String[] commandLine)
at TrailingBackslash.My.MyApplication.Main(String[] Args) in 17d14f5c-a337-4978-8281-53493378c1071.vb:line 81
at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
InnerException:

The project is a basic .msi and it is not special. It has a component, feature and a key file. It is not open ... It is not read only, and it is in the temp directory - spelled case sensitive ...

Thanks in advance ...
Labels (1)
0 Kudos
(4) Replies
lasiewicz
Level 6

Pretty simple , you need to point to the .ism ,not the msi.

If it still crashes then ISWiAuto18 is not registered.
0 Kudos
jstarbird
Level 5

Your post says you're trying to Create Shortcuts but the Automation API is for build time not run time so if you're trying to update the MSI at Run time you need to use another method. So not sure this is really what you're looking for but it sort of sounds like it.
I just went through this myself recently and found these links to be helpful:

http://community.flexerasoftware.com/showthread.php?t=182498&highlight=shortcut+formatted

and

http://community.flexerasoftware.com/archive/index.php?t-112283.html

This should give you an idea of what you need to do.

Goodluck,
J
0 Kudos
Christopher_Pai
Level 16

Also be aware that the COM Automation interface will only work from a 32bit process. Also if you wish to manipulate a built MSI using Managed Code, I suggest looking at the DTF libraries found in Windows Installer XML. Microsoft.Deployment.WindowsInstaller* namespaces have everything you need to open the MSI as a database or package and even has basic support for LINQ.
0 Kudos
iwesley
Level 4

Thanks for all of the help folks ... I have not worked on the code yet, but I see taht I probably need to make changes at build time if 64-bit is an issue.

iW
0 Kudos