Solved

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

Posted on 2014-01-28
4
710 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 26

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 26

Expert Comment

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

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

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
SCCM 2012 Report 8 102
Sharepoint to FTP? 3 48
Display multiple images in report 12 83
Using MS Code on my Mac 6 45
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 …
Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
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…
The viewer will learn how to use a discrete random variable to simulate the return on an investment over a period of years, create a Monte Carlo simulation using the discrete random variable, and create a graph to represent the possible returns over…

708 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

17 Experts available now in Live!

Get 1:1 Help Now