Click here to Skip to main content
12,078,489 members (46,106 online)
Rate this:
 
Please Sign up or sign in to vote.
See more: VB VB.NET installer setup
I am creating folders during my installation

Public Overrides Sub Install(ByVal stateSaver As System.Collections.IDictionary)
        MyBase.Install(stateSaver)
        InstallDir = Me.Context.Parameters("dir")
       
        Try
            Directory.CreateDirectory(folder1)
            Directory.CreateDirectory(folder2)
           
            File.Create(folder1+ "\test1.txt")
            File.Create(folder2+ "\test2.txt")
        Catch ex As Exception
            MsgBox(ex.Message)
        End Try
    End Sub

Public Overrides Sub Uninstall(ByVal savedState As System.Collections.IDictionary)
        MyBase.Uninstall(savedState)
End Sub

I am using this code for uninstalltion but unfortuantely it is not deleting the folders and files.
how do i do i delete the files.

Regards
SK
Posted 19-Jun-12 2:46am
Edited 19-Jun-12 2:52am
v3

1 solution

Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

I don't think that this is unfortunate. It's just that you haven't handled it.

You have to use Custom Actions for that:
1.Add a new library ("CustomActions") to the setup project
2.Add => New Item => Installer class
3.Switch to code view and override the Uninstall method

public override void Uninstall(IDictionary savedState)
{
    base.Uninstall(savedState);
 
    // Delete folder here.
}

1.Add the project output (Primary Output) of the CustomActions project to the setup project.
2.Right click your setup project and click View => Custom Actions
3.Rigth click uninstall => Add Custom Action => Application Folder => Primary Output of CustomActions
  Permalink  
Comments
oppai_kamu 19-Jun-12 8:09am
   
Thank you for the reply
I have
1.added a Installer class to the project.
2.Install method is overwritten as shown above.
3.Uninstall method is written as below
MyBase.Uninstall(savedState)
InstallDir = Me.Context.Parameters("dir")
Try
Directory.Delete(folder1)
Directory.Delete(folder2)
Catch ex As Exception
MsgBox(ex.Message)
End Try
4.to custom actions i have added primary output by right clicking on uninstall.

Am i am missing something?
i am uninstalling through Add/Remove in the control Panle
please advice.
Prasad_Kulkarni 19-Jun-12 8:21am
   
Five!!!
Manas Bhardwaj 19-Jun-12 8:25am
   
thx!
VJ Reddy 20-Jun-12 22:38pm
   
Good answer. 5!
Manas Bhardwaj 21-Jun-12 3:15am
   
thx!
Sandeep Mewara 21-Jun-12 16:44pm
   
Nice. 5!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Mobile
Web04 | 2.8.160212.1 | Last Updated 19 Jun 2012
Copyright © CodeProject, 1999-2016
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100