Custom setting at un-install for file/folder deletion - windows

Using Advanced installer for my java based application, it is working very good. I want to remove one folder and one file when user uninstall the application from system. Now my question is
1) how to remove a file from a given location e-g i have an abc file at desktop and i want if it exist there it should be deleted while user will uninstall the application(file will be on the same path and with same name for all) ?
2) how to delete a folder from the system while user uninstalling the application ?
3) if (2 i-e folder deletion) is possible then, can i change the location of the folder(i want to delete at uninstall) programmatic-ally ?
Thanks in advance.

Assuming your are using the latest version of Advanced Installer.
1) You can go to Files and Folders page and from the toolbar, under "File Operations", add a File Removal, which you can configure to run during install or uninstall
2) Right click on the desired folder and go to "Operations" tab, there you will find the options you need
3) Yes, you can specify the path programmatic-ally, but you need to do it from the beginning of the install process, using a property based folder. So basically you create your property based folder and configure options from Operations tab for it.

Related

Visual SourceSafe doesn't create root folder

I'm working with Visual SourceSafe but I'm getting a problem because when I try to download a project using Get the Last Version doesn't create the root folder, this create all subfolders. For example:
If I use "Get Last Version" on the folder "VisualStudio" doens't create a folder called IMECPP, create all the subfolders (CD, CN, EntidadesEmpresariales)...
What could be the problem?
(I can't change to git or others, I have to use SourceSafe).
Thanks in advance.
In the dialog box of "Get Last Version" you may specify the destination folder in the field "To:", it should include the highest folder "IMECPP".
If this folder does not already exist in your local drive, then VSS will create it (and all the path before).
You also have to cross check the "recursive option".
If you click on "Extended>>" you will have access to 2 more options that can also change the behaviour of the command.

Change Visual Studio Emulator for Android vhd install path

Is it possible to change the default path that the VS emulator is storing the .vhd files? By default it's set to store them under my %LOCALAPPDATA% folder, but that's on my C drive and I'm running out of space on C.
How can I set it to store them in D:\emulators?
#Ionian316
1/ Open regedit.
2/ Go to: HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\VisualStudioEmulator\Android\Configuration\
3/ Find file UserConfigurationPath
4/ Input your path in here:
Default path is: %LOCALAPPDATA%\Microsoft\VisualStudioEmulator\Android
New path example: D:\VisualStudioEmulator\Android
Of course, you should copy from default path to new path for not be error.
EDIT 1
There is a solution pointed in VS Emulator for Android troubleshooting (link):
Open Registry Editor by selecting Run from the Start buttons context menu, typing regedit in the dialog box, and choosing OK.
Navigate to HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Android SDK Tools in the folder tree on the left.
Modify the Path registry variable to match the path to your Android SDK.
However, this solution seems out-of-date for current available VS Emu 4 Android versions. I can not find the registry folder in the tree.
EDIT 2
Here is a simple way to do, by which I managed to change the root Path of vhd.
Situation 1: Already installed
Rename folder %USERPROFILE%\AppData\Local\Microsoft\VisualStudioEmulator\Android\Containers\Local\Devices\vhd\ to something else, for backup.
Create folder D:\emulators.
Open cmd command-line, type in MKLINK /J %USERPROFILE%\AppData\Local\Microsoft\VisualStudioEmulator\Android\Containers\Local\Devices\vhd\ D:\emulators, press Enter.
After junction made, move everything in backuped vhd folder to D:\emulators.
You've done.
Situation 2: Not installed yet
The steps are similar to those in Situation 1, but you do not need to rename for backup, nor move the backuped stuff to D:\emulators.
You just need to make the junction, and then install VSEmu4Android.
EDIT 3
NOTE:
For proper usage of vhd's in Hyper-V (which is used by VSEmu4Android), your D:\emulators folder and files inside should not be compressed.

How can I export/import settings of Sublime Text 3 from one PC to another using Windows?

I use Sublime Text 3 in my company and I want to export all the settings, including packages and whatever, to use the same configurations in Sublime Text 3 I have at home. How can I do this?
PS.: I use Windows 8
The best way is to sync the User directory, there are multiple available ways to do this - dropbox, git and manual ways.
Installed packages are registered in Package Control.sublime-settings, which is located in the user folder as well, thus, it does not require you to sync anything besides that. A pretty good guide to syncing can be found here.
You also may wish to check out this package.
For me (Windows installation) transferring all the content from old installation - AppData\Roaming\Subime Text 3, to new installation - AppData\Roaming\Subime Text 3, does the job. All the packages and UI settings are transferred and are working correctly.
None of the manual efforts are needed now (I think). Both sublime text (ver 3) and visual studio code (if anyone cares) have extensions that do this for us.
For VS Code -
https://marketplace.visualstudio.com/items?itemName=Shan.code-settings-sync
For ST3 -
https://packagecontrol.io/packages/Sync%20Settings
With a few clicks like generating token and configuration, one should be able to easily port the settings from any machine (Win, OSX, Linux) to any machine.
You can try this plugin PackageSync. It can package your settings and packages into a zip or 7z file, then, you can import them on another machine.
As an aside an easy way to locate the 'User' or 'Sublime text {2/3/etc}' folder regardless of OS is to:
Open go-to-anything and just type: 'us'
From the available options select 'Preferences: Package Control Settings - User’ to open that file.
Right click on the file and make the selection to open the containing folder (Mac: reveal in finder)
Navigate back up to the parent folder Sublime Text 3 (or whatever version number you are on)
Copying this folder and replacing the Sublime Text 3 folder in a fresh Sublime install with this one should install all packages and replicate any other settings you have.
source
"If you want to sync settings across machines, the best way to do so is to just sync the Packages\User\ folder. This contains all customized settings, and if you are using Package Control, it includes a list of all installed packages. If Package Control sees that an installed package is not present on the machine, it will automatically install it the next time Sublime Text starts."
PS: if I am not mistaken the author of this post is the key developer of sublime.

How to setup Installer project with conditional file copying

I am building a VS 2010 installer, and I want to copy files to app folder depending on what options I select in UI (UI is not simple, so the only option is to show custom dialogs in Install custom action).
The problem is that custom action is actually executed after files are copied already.
One possible solution I can think of is to install all these files into the app dir, and then delete some unnesessary files in custom action. But these files are "secure" in some way, so I don't want to copy them to filesystem, even for a short period of time.
Any thoughts?
If your files shouldn't ever be on the filesystem, you have a problem in the requirements. The .msi storage itself is an open format and can be read by many tools, so if someone knows the file it's possible for them to find and extract it manually.
I agree that it's better to avoid deleting the files after they've been installed for two reasons. One: it avoids wasted work, and two: it won't cause repair scenarios due to missing files that Windows Installer thinks should be present. You should probably figure out how to determine whether these files should be present at an earlier stage of the installation, and set properties that cause this to happen (disable components by condition, or change feature states).
Most controls in MSI dialogs use installer properties. For example, a checkbox may use a property named MY_CHECKBOX which is set to a value or it's empty, based on whether the checkbox is checked or not.
These properties can be used to condition files:
select your setup project in Solution Explorer
click File System Editor button from Solution Explorer top pane
select the file you want to condition
in its Properties pane set Condition field to the condition you want, for example
MY_CHECKBOX = "value"

Visual Studio Setup Project - conditionally install file

I have a VS 2008 Setup project. I only want to install an XML file if it does not already exist on the target system. The installer overwrite rules for non versioned files ensure that a file will never be overwritten if it has not been modified on the target system. But I want to never overwrite the file. There is a Condition property that can be set on a file in the Visual Studio installer properties for a file. What is the correct syntax for the Condition property to check for existence of file and only install if it is not there?
You will need to go to the Launch Conditions tab and search the target computer for the file you want to check for. The launch condition will let you specify the name of a property it will set to the path of the file if it exists, otherwise it will be empty. You can now use this property as the condition on your file.
I was able to use a launch condition to set a property, and use this for a conditional install of a file, so I will mark 'heavyd' as the correct answer. However, was not able to use the file search effectively, as was suggested (see comments on the answer). Instead, I used a Windows Installer Search (one of the three types of searches available in a VS 2008 Setup Project) with the MSI ComponentID, as follows (I found the technique here):
Product 1 is installed and has a file named MyFile.txt.
You use ORCA (from the Windows Installer SDK) to view the File table, and find the row that represents MyFile.txt.
You get the value of the Component_ column and then open the Component Table.
In the Component Table you find the row that has the Component_ value in the Component column, and get the ComponentID. Copy this value into clipboard. Close ORCA.
In your setup project, open the Launch Conditions Editor and add a Windows Installer Component Search. For the ComponentID property of the new search, paste the ComponentID.
Copy the Property property. It should be something like COMPONENTEXISTS1.
Open the File System Editor and select the Application Folder, then select the file you want to conditionally install.
Edit the Condition property to be COMPONENTEXISTS1 = FALSE.
Set the Transitive property to true if you want the condition to be evaluated each time the installer is run (not just the first time).
Now, MyFile.txt will only be installed if it is not already there.
There is one caveat with this technique: Doing a repair on the installation will cause the file to be deleted, even though the file is marked as Permanent! Not good. I worked around this by adding some custom actions (calling vbscript files) to backup and restore my file.
What a hassle to just achieve so simple a task: install a file once on initial install, then, never again overwrite it.
If anyone has a better solution, I am all ears.

Resources