Solved

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

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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Many companies are making the switch from Microsoft to Google Apps (https://www.google.com/work/apps/business/). Use this article to learn more about what Google Apps has to offer and to help if you’re planning on migrating to Google Apps. It is …
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.
Viewers will learn the different options available in the Backstage view in Excel 2013.
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…

821 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