Calling a .NET assembly

Got a problem you cannot solve? Try here.
yosilevy
Posts: 25
Joined: Fri Jan 23, 2009 3:31 am

Calling a .NET assembly

Postby yosilevy » Sun Jul 11, 2010 2:01 pm

Is there a way to call a .NET assembly similar to the Call DLL plugin? (assuming running on Vista/7 on which .NET is surely installed).

Thanks.

mills
Posts: 814
Joined: Tue Jul 06, 2010 7:10 pm
Location: Honolulu, HI

Re: Calling a .NET assembly

Postby mills » Mon Jul 12, 2010 2:17 pm

Unfortunately, it is not possible to call a .NET assembly at this time like "Call DLL Function", since we can't guarantee the presence of the .NET framework.

The best thing to do at this time would be to build a console application that makes use of the assembly, then run that using "Run Program As".
Andy Mills
InstallAware
Other Help:
White Papers (HowTos) - http://www.installaware.com/publication ... papers.htm
Product Guides - http://www.installaware.com/publication ... guides.htm
InstallAware Help - Press F1 in the InstallAware IDE.

pokr2
Posts: 17
Joined: Fri Feb 11, 2011 12:40 pm

Re: Calling a .NET assembly

Postby pokr2 » Tue May 03, 2011 5:08 pm

And what about "Run .NET Installer class"?

Thanks, regards,

Octavio

giaviv
Posts: 2039
Joined: Fri Dec 17, 2010 1:39 pm

Re: Calling a .NET assembly

Postby giaviv » Tue May 03, 2011 7:23 pm

Octavio,

That's something else - what exactly are you trying to do?
Aviv Giladi
InstallAware Software

White Papers (HowTos) - http://www.installaware.com/publication ... papers.htm
Product Guides - http://www.installaware.com/publication ... guides.htm
InstallAware Help -F1 anywhere in the InstallAware IDE

pokr2
Posts: 17
Joined: Fri Feb 11, 2011 12:40 pm

Re: Calling a .NET assembly

Postby pokr2 » Wed May 04, 2011 3:50 pm

Giaviv,

I was trying to run some code hosted in a managed code DLL at install time. So I found this thread :-)
What I've done:
- Create a DLL Project in Visual Studio, and add an Installer class to it, overriding the Install() method, where you put the code you want to run (there are other entry points: Commit(), Rollback() and Uninstall()).
- Add the resulting DLL to your InstallAware project as a support file.
- Call it from the script at the desired moment using the "Run .NET Installer Class" command. Use the $SUPPORTDIR$ variable to specify the path to the DLL.
- My project installs .NET Framework (if not available already in the host machine) BEFORE calling the DLL, so I can guarantee the necessary runtime support.

Seems to work great!

Regards - Octavio

giaviv
Posts: 2039
Joined: Fri Dec 17, 2010 1:39 pm

Re: Calling a .NET assembly

Postby giaviv » Wed May 04, 2011 5:33 pm

Yep that would be to solution - thanks for sharing!
Aviv Giladi
InstallAware Software

White Papers (HowTos) - http://www.installaware.com/publication ... papers.htm
Product Guides - http://www.installaware.com/publication ... guides.htm
InstallAware Help -F1 anywhere in the InstallAware IDE

bokkie
Posts: 767
Joined: Sun Feb 08, 2009 6:30 am

Re: Calling a .NET assembly

Postby bokkie » Thu May 05, 2011 1:47 am

Octavio,

Thanks for the heads-up on that and it works well. When I tested it, I found the call to the Install(...) method is called twice even though I have only one reference to "Run .NET Installer Class". Did you experience that as well? I have a hunch that the internals of the installer might be doing that but I'm not sure. I'm not sure if I'd need to use it but it's something I'll keep in mind if I have ever the need to do so.
Peter. Smartly dressed, he still resembles an unmade bed.
InstallAware MVP

pokr2
Posts: 17
Joined: Fri Feb 11, 2011 12:40 pm

Re: Calling a .NET assembly

Postby pokr2 » Fri May 06, 2011 7:47 pm

Hi bokkie,

Sorry for the late answer, it's been a tough week...
I haven't observed any duplication of calls, and put some WinForms MessageBoxes in the code for checking. During install, there is a call to Install and a call to Commit (I'm using IA 9 R2).
BTW, you can log all the assembly activity by means of using Context.LogMessage("I'm here!"); in your methods.
The log file is generated in the support directory (which is normally %TEMP%\mia1); you need to grab it before hitting the 'Finish' button of the installer, because the whole folder will be deleted after installation finishes. Surely there's a way to move the log to another place, but haven't had time to investigate :-).

Regards - Octavio

pushpankar
Posts: 5
Joined: Mon Apr 16, 2012 12:46 am

Re: Calling a .NET assembly

Postby pushpankar » Wed Apr 18, 2012 12:36 am

hi
i am managed to call a ,net installer class using Run .net installer method of installaware script
in the Install method i need to set the Target dir path (path where product gets installed)

in windows i used to get it through

Me.Context.Parameters.Item("DIR").ToString
how should i get in a installer class using install aware.

Public Overrides Sub Install(ByVal savedState As IDictionary)
MyBase.Install(savedState)
If ProjectOpKey.OpkeyEdition <> OpkeyEditions.Lite Then
Dim LV As New LicenseValidator
LV.DirPath = Me.Context.Parameters.Item("DIR").ToString /////////here i am getting the target dir path.
If LV.ShowDialog = Windows.Forms.DialogResult.OK Then
Else
Throw New InstallException("Rolling Back Installation...")
End If
End If
End Sub

FrancescoT
Site Admin
Posts: 5361
Joined: Sun Aug 22, 2010 4:28 am

Re: Calling a .NET assembly

Postby FrancescoT » Wed Apr 18, 2012 9:07 am

Dear User,

please do not post the same question in different forums. I have already replied to you in Plug In Forum.

so please check:
http://www.installaware.com/forum/viewtopic.php?f=3&p=31021#p31021


Regards
Francesco Toscano
InstallAware Software

White Papers (HowTos) - http://www.installaware.com/publication ... papers.htm
Publications - http://www.installaware.com/publications-review.htm
InstallAware Help -F1 anywhere in the InstallAware IDE


Return to “Technical Support”

Who is online

Users browsing this forum: Google [Bot] and 33 guests