Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
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 at 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 at 19-Jun-12 8:21am
   
Five!!!
Manas Bhardwaj at 19-Jun-12 8:25am
   
thx!
VJ Reddy at 20-Jun-12 22:38pm
   
Good answer. 5!
Manas Bhardwaj at 21-Jun-12 3:15am
   
thx!
Sandeep Mewara at 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
0 George Jonsson 215
1 Kornfeld Eliyahu Peter 169
2 Zoltán Zörgő 139
3 PIEBALDconsult 130
4 OriginalGriff 120
0 OriginalGriff 6,165
1 DamithSL 4,658
2 Maciej Los 4,107
3 Kornfeld Eliyahu Peter 3,649
4 Sergey Alexandrovich Kryukov 3,342


Advertise | Privacy | Mobile
Web04 | 2.8.141220.1 | Last Updated 19 Jun 2012
Copyright © CodeProject, 1999-2014
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