tslewis
Posts: 65
Joined: Wed Mar 13, 2013 7:06 am

Delete .NET Installer Class After Use as Custom Action

I am using a .NET installer class that is installed by my package. Obviously for this type of custom action I have to install it and cannot embed it within the package.

My question is, this is a temporary DLL and I do not want it to stay in the folder once the installer has finished. I had tied adding it as a temporary file but then when I try to add the Insatller class using the custom action dialog, there is no option to select it as it is not available form the list of DLLs that I can use.

Is there an option to delete .NET installer class action dlls? Why aren't they automatically deleted? Why cant I add such a DLL as a temporary file?

cheers
Eusebiu
Posts: 4971
Joined: Wed Nov 14, 2012 2:04 pm

Re: Delete .NET Installer Class After Use as Custom Action

Hi,

I'm not sure why you can't pick the file from the "Temporary" folder. I attached here a sample that has a DLL file in the "Temporary" folder and a ".Net Installer Class" custom action that uses the file.

Best regards,
Eusebiu
Attachments
.Net installer class.aip
(11.28 KiB) Downloaded 793 times
Eusebiu Aria - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
tslewis
Posts: 65
Joined: Wed Mar 13, 2013 7:06 am

Re: Delete .NET Installer Class After Use as Custom Action

Right, Yes I can add it, but get back to me when you can delete it. Because I have tried the delete file action in program files and folders and it doesn't work
Eusebiu
Posts: 4971
Joined: Wed Nov 14, 2012 2:04 pm

Re: Delete .NET Installer Class After Use as Custom Action

Hi,

Sorry, I misunderstood and added the DLL as a regular file in the "Temporary" folder not as a temporary file.

Unfortunately, a temporary file cannot be used by a ".Net Installer Class" custom action.

As a workaround, you can create your DLL as described in the How do I create fully fledged C# custom actions article and use it in a "Launch attached file" custom action where you can choose which function of your DLL to use. In this case the file will be automatically added as a binary file and will not be copied in the installation folder.

Let us know if this helped, otherwise give us more details about your scenario.

Best regards,
Eusebiu
Eusebiu Aria - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
tslewis
Posts: 65
Joined: Wed Mar 13, 2013 7:06 am

Re: Delete .NET Installer Class After Use as Custom Action

Correct me if Im worong but A "lauch file" custom action is not the same as a ".NET Installer class" which is installed by the isntaller whereas a "aunch file" custom action is not.

Unfrotunatley I know little to none C# or C++ code, so as I am using VB.NET it looks like a "launch file" custom action will not work for me.

I have also tried a delete file option in progrrams and files panel of AI GUI. This didnt work.

If files ares specified as being installed in a temporary folder sholdnt i be assumed they will be automatically deleted after installtion?

How do I remove my installer class after installation? Can you direct me to an example?
Eusebiu
Posts: 4971
Joined: Wed Nov 14, 2012 2:04 pm

Re: Delete .NET Installer Class After Use as Custom Action

Hi,

I supposed that you use C# language because this is used by most of our customers.
Correct me if Im worong but A "lauch file" custom action is not the same as a ".NET Installer class" which is installed by the isntaller whereas a "aunch file" custom action is not.
Yes, you are right, a file used by a "Launch attached file" custom action in not installed by the installer.
I have also tried a delete file option in progrrams and files panel of AI GUI. This didnt work.
Did you try the "File Removal" operation and it didn't work? Can you send us the .AIP (project file) so we can see if it was configured correctly?
If files ares specified as being installed in a temporary folder sholdnt i be assumed they will be automatically deleted after installtion?
The files in the "Temporary" folder are removed only if the user make a cleanup to that folder.
How do I remove my installer class after installation? Can you direct me to an example?
The "File Removal" operation should be able to remove your file. Unfortunately, I don't have any example for this.

Best regards,
Eusebiu
Eusebiu Aria - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
tslewis
Posts: 65
Joined: Wed Mar 13, 2013 7:06 am

Re: Delete .NET Installer Class After Use as Custom Action

Yes I tried the file removal operation and it did not work.
tslewis
Posts: 65
Joined: Wed Mar 13, 2013 7:06 am

Re: Delete .NET Installer Class After Use as Custom Action

Attached simple AIP file which describes the problem. I have tried everything.

Installer installs a text file - you may want to rename it. Then ive added a file operation to remove it. Doesn't work, same as what Im getting with a more complicated project using a custom action.

Very very frustrating.

I would appreciate some feed back here after 3 weeks of using AI I am still no closer to having a solution....

cheers
Attachments
Setup.aip
(10.76 KiB) Downloaded 652 times
test.txt
(7 Bytes) Downloaded 539 times
tslewis
Posts: 65
Joined: Wed Mar 13, 2013 7:06 am

Re: Delete .NET Installer Class After Use as Custom Action

Before you reply, I have tried multiple conditional statements, not registering with the MSI installer, selecting different components.....
tslewis
Posts: 65
Joined: Wed Mar 13, 2013 7:06 am

Re: Delete .NET Installer Class After Use as Custom Action

Also tried the file copy operation on the txt file. Doesn't work.

Using VS2012, .net 4.0, AI 10.
Eusebiu
Posts: 4971
Joined: Wed Nov 14, 2012 2:04 pm

Re: Delete .NET Installer Class After Use as Custom Action

Hi,

Indeed, the "File Removal" operation does not work because this operation is done before adding the resources of the application.

As a workaround you can create a custom action which deletes your DLL after the installation is finished. For example you can use the VBScript code below in a custom action placed under the "Install Execution Stage -> Finish Execution" action group.

Code: Select all

 folderName = Session.Property("APPDIR")
 sFileSpec = folderName&"test.txt"
 DeleteAFile(sFileSpec)

 Sub DeleteAFile(filespec)
 Dim fso
 Set fso = CreateObject("Scripting.FileSystemObject")
 If (fso.FileExists(filespec)) Then fso.DeleteFile(filespec)
 End Sub
Where "test.txt" is the name of the file that you want to remove.

For this custom action to work the "Run as administrator" option must be selected in the Install Parameters page, in which case you will have an EXE package instead of MSI.

Let us know if this helped.

Best regards,
Eusebiu
Eusebiu Aria - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
tslewis
Posts: 65
Joined: Wed Mar 13, 2013 7:06 am

Re: Delete .NET Installer Class After Use as Custom Action

No no help at all really.

Please explain what use are the file operations then? I dont jnderstand. i dont want to go trough the effort of Adding a custom action creating an exe and making sure the user is an admin. My user is most likely an admin. I know the vbscript option works from your faq.

Pleae expalin what and when you use file operationss such as remove copy for? I have read your help several times and you do not explain this or any limitations.

I also can ot get the folder delete option to work. Is this related? Your help needs to improve and clarify tgese things
tslewis
Posts: 65
Joined: Wed Mar 13, 2013 7:06 am

Re: Delete .NET Installer Class After Use as Custom Action

and why in earth dont u support vb.net custom actions other than an installer class that i have to install, this is a real pain
Eusebiu
Posts: 4971
Joined: Wed Nov 14, 2012 2:04 pm

Re: Delete .NET Installer Class After Use as Custom Action

Hi,

The file operations are used a lot by our users. For example you can copy/move a file from a location to another, you can duplicate a file or remove a persistent file or a file created by a custom action that is not automatically uninstalled along with the application.

The Folder Operations Tab article explains how you can use the "Remove folder" option.

Best regards,
Eusebiu
Eusebiu Aria - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
tslewis
Posts: 65
Joined: Wed Mar 13, 2013 7:06 am

Re: Delete .NET Installer Class After Use as Custom Action

Yes i have read your help. It does not explain it otherwise i would not be posting here would i. Please can u provide an example? You are supposed to use this action at install time but as you said it it wont work until resources are installed. How then does this work to remove files created by a custom action when uou can only activate the file remove action when the custom installed action is being installed?

Return to “Building Installers”