Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Visual Studio setup, how to uninstall folder with files in it.

Posted on 2014-01-28
4
Medium Priority
?
839 Views
Last Modified: 2014-02-03
I have a Microsoft Visual Studio 2010 win32 application and recently I’ve added a Setup Project to create a .msi install/uninstall file. I created a custom folder, let’s call it c:\myfolder\logs, that gets created on install. When my application runs it creates a log file that it creates and placed in the ‘c:\myfolder\logs’ folder. My problem is that on uninstall everything is uninstalled except for the ‘..\logs’ folder’. I believe this is because there are files within the …\logs folder.

Is there some way to tell the Setup Project I want this folder and all files within deleted on uninstall?

I really don’t want to have to create a ‘custom dll’. Seems like a lot of work for a simple request.

Thanks.
0
Comment
Question by:atomicgs12
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
4 Comments
 
LVL 27

Expert Comment

by:MacroShadow
ID: 39817367
You can use the  RemoveFiles action, for that you will need to use the RemoveFile Table.
Alternatively you can create a simple bat file to delete the directory.
0
 

Author Comment

by:atomicgs12
ID: 39817981
if I created a bat file how would I get VS setup to run the bat file at uninstall time?
Thanks
0
 
LVL 27

Expert Comment

by:MacroShadow
ID: 39818455
Action Test
Type 34
Source SystemFolder
Target cmd.exe /c c:\test.bat
ExtendedType <blank>
0
 
LVL 27

Accepted Solution

by:
MacroShadow earned 1500 total points
ID: 39818459
Question
How can I execute a .BAT file from an .MSI installation?

Answer
To execute a .BAT file in a Windows Installer installation, you will have to use a custom action. Do the following:

    In the .WSI file, select View > MSI Script..
    In the Installation Sequence list, click the location in the sequence where you want to place the custom action.
    Double-click the Execute Program from Path custom action on the Custom tab. The Execute Program from Path dialog displays.
    Populate the Details tab as follows:
        Name: Enter a name for the custom action.
        Property: Enter %COMSPEC. This is the environment variable that holds the location of the cmd.exe program.
        Command Line: Enter "/c <path to .BAT>\<batchfile.BAT>" (replacing the text in <> with the path and name of your batch file. Enclose the path and batch file name in double quotes. The /c switch closes the cmd.exe window after the batch file executes. To execute the batch file and keep the cmd.exe window open, enter /k instead. (This can be useful for debugging batch files.)

        Note: The cmd.exe launches in the System directory by default. If your batch file executes actions in another directory, you must explicitly account for that in the batch file. For example, to list the files in c:\mydir, add a line to the batch file that reads 'cd c:\mydir'.
    Click OK.
http://www.symantec.com/business/support/index?page=content&id=HOWTO4383
0

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This very simple solution applies to a narrow cross-section of the "needs to close" variety. In this case, the full message in Event Viewer was in applog, Event ID 1000: Faulting application iexplore.exe, version 8.0.6001.18702, faulting module …
Technology opened people to different means of presenting information, but PowerPoint remains to be above competition. Know why PPT still works today.
The viewer will learn how to simulate a series of coin tosses with the rand() function and learn how to make these “tosses” depend on a predetermined probability. Flipping Coins in Excel: Enter =RAND() into cell A2: Recalculate the random variable…
The viewer will learn how to use the =DISCRINV command to create a discrete random variable, use this command to model a set of probabilities and outcomes in a Monte Carlo simulation, and learn how to find the standard deviation of a set of probabil…

722 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question