Solved

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

Posted on 2014-01-28
4
730 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
  • 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 500 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

U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

Question has a verified solution.

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

Suggested Solutions

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 …
This collection of functions covers all the normal rounding methods of just about any numeric value.
Viewers will learn the different options available in the Backstage view in Excel 2013.
The view will learn how to download and install SIMTOOLS and FORMLIST into Excel, how to use SIMTOOLS to generate a Monte Carlo simulation of 30 sales calls, and how to calculate the conditional probability based on the results of the Monte Carlo …

919 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now