Solved

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

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

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

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

For a while now I'v been searching for a circular progress control, much like the one you get when first starting your Silverlight application. I found a couple that were written in WPF and there were a few written in Silverlight, but all appeared o…
Article by: Leon
Software Metering within our group of companies has always been an afterthought until auditing of software and licensing became a pain point. Orchestrator and SCCM metering gave us the answer and it was an exciting process.
The viewer will learn how to simulate a series of sales calls dependent on a single skill level and learn how to simulate a series of sales calls dependent on two skill levels. Simulating Independent Sales Calls: Enter .75 into cell C2 – “skill leve…
The viewer will learn how to create a normally distributed random variable in Excel, use a normal distribution to simulate the return on an investment over a period of years, Create a Monte Carlo simulation using a normal random variable, and calcul…

776 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