How can I ensure that the msi installer (created using visual studio installer project) installs the application at the same location where its previous version was installed ?
So for example the scenario is this.
User install the app using myapp-v1.msi installer at c:\program files\myapp
Now I fix a bug and create a new version of installer myapp-v2.msi
When the user installs myapp-v2.msi it should install at c:\program files\myapp (perhaps not giving the location choice to user)
I want to do that because I have data files present in the previous location and I want that new files go in the same location so that it picks up data files from it's current directory.
Thanks,
That should be done automatically, as default behavior in MSI packages. Have you tested it?
However, you should know that keeping data files next to the installed files is not recommended, nor standard practice. If these data files should be available to all users you should store them in CommonAppDataFolder.
Related
I already had trouble finding out where appSettings get stored when the app is installed in program files directory.
Now the next thing is finding out how to make the app installer update that location too. Because obviously, Microsoft Windows doesn't do it.
When the app is installed in program files and you try to update its settings file the setting file actually got saved to another location: C:\Users\user\AppData\Local\VirtualStore\Program Files (x86)\company\app
How to make Visual Studio Installer remove this file during installation?
I'm creating a Windows Installer (.msi) files by Visual Studio Setup Project.
When run .msi file, if target folder already existed and had some files and subfolders then how can i delete them before install my application ?
I have already searched but not found solution.
For an upgrade this should help:
https://www.red-gate.com/simple-talk/dotnet/visual-studio/updates-to-setup-projects/?_ga=2.123102924.696294303.1504290215-1234024276.1504290215
Basically update the setup project's version, accept changes, set RemovePreviousVersions to true when building your upgrade MSI. In addition (not in the article) you must increment the file versions of binaries that are being upgraded. This will do an uninstall of the older product as it installs the new version.
The post doesn't say where the temp files are, but if they are data files or temp files the app shouldn't be creating them in (say) the Program Files folder because it's not the recommended place (there are well defined folders for temp files, such as the Temp Folder), and it requires elevation to write/update files in Program Files so the app is therefore limited to admin users.
Uninstalls don't remove files created by the app (you wouldn't want an uninstall of Word to remove all your doc files) so it might be easier for the app to either not create them there in the first place, or remove them when it first starts up. The normal code solution for uninstalls would be an uninstall custom action in your older product that removes them, but if that old version is already shipped then it's too late.
Also, in a fresh install (even if it's an upgrade) the user could choose to install to another location, if you show the browse dialog to choose the Application Folder, and that means that the files are left in some orphaned Program Files folder, for example.
I have created a visual studio setup project that writes content files to User's Application Data Folder
C:\users\user\AppData\Roaming\CompanyName
I did this By adding User's Application Data Folder in File System on Target Machine link from setup project and adding content files to that folder.
When I install this setup it installs only for one user(active). I want this to install content files to all users AppData folders
Example folder locations:
1.C:\users\user1\AppData\Roaming\CompanyName
2.C:\users\user2\AppData\Roaming\CompanyName
How to install these content files to each and every user's AppData folder on the machine using Visual Studio Setup project.
Any help is greatly appreciated.
The short answer is that you can't. There's no way of enumerating all those folders and installing files to them, and that won't work anyway if a user account gets created after your setup has been installed.
The good news is that it should just work. Assuming your installed app has a shortcut to the program, and the setup was installed for Everyone, log on as another user and use the shortcut. What should happen is that Windows will notice that the user doesn't have the files and it will ask for the original MSI file to install them. This works even if the user account wasn't present at the time of the install, and will happen just once per new user of the app to install the files.
I have a Setup Project that I made using Visual Studio 2010.
The application that I made (and which the Setup Project deploys) has been released for a while now such that there are users that have the application already installed on their machines.
Since the initial release of the application, the company that I work for has changed its name. Without thinking too much about it, I simply changed the [Manufacturer] name in the setup project's Deployment Project Properties to the new company name.
Unfortunately, now when a user updates their existing installation of the application with the new updated application, the directory that was in \Program Files\Old Company Name remains untouched and a new directory \Program Files\New Company Name is created and the new update is installed in this new directory.
It makes sense to me why the scenario above is happening - However, do you know if Visual Studio has options/settings that I can set that will tell the setup project to rename the existing \Program Files\Old Company Name directory to \Program Files\New Company Name and then install the update in that new directory?
If this is an update to the application then, it is really only possible through custom actions as Mark Hall suggests. However if it is a complete installation of the application then it is possible to force a uninstall of the previous version and the reinstall to the new version to the new folder.
In your Setup Projects properties update your Major version number and allow the "Product code" guid to be updated, ensure that the "RemovePreviousVersion" is true and that the "UpgradeCode" has not changed.
This should force the uninstall of the previous version and install the new version to the new folder.
To answer your question. No there is no built in way to rename your directory before install through the Visual Studio Setup Project. If it could be done it would need to be through a Custom Action See this MSDN Forum link on Custom Actions and this Forum Link also. Your best bet might be to to a full installation and then copy any settings from the old directory to the new directory then delete the old directory. That can be done running a Custom Action during the commit actions of the setup.
If you don't need the \Program Files\Old Company Name directory anymore, can't you remove it as part of new installation?
I have an application which is deployed with an msi installer. It's version 2. When installing this latest version of this installation, the installer copies everything into the program folder (dlls,exe,resourcefiles).
But when upgrading this application from Version 1 to 2, some strange things happen. The upgrade is good, and it removes the previous files and copies the DLLs into the folder and completes the installation wizard.
When I now look in the installation folder ONLY the DLLs are present.
When I run the application from the start menu for the first time, it fires a MSI shortcut and the installer shows up again to do some configuration. Now it copies the executable and the resource files and starts the application.
Why doesn't the installer copy everything on the upgrade? I want to this to be the behaviour because the users who will start this app for the first time may not have sufficient access rights for this kind of operation
During an upgrade Windows Installer uses the file versioning rules to determine if a file is installed or not. To install all files during an upgrade you can make sure that:
all files are placed in components that have a versioned file as key member
all key member files have a higher file version compared to your old installation
Windows Installer evaluates if a component will be installed or not based on it's key member. So if the key member file has a higher version than what's on the machine, that component is installed.
Another solution is to set the Version column in File table to a high value, for example 65535.65535.65535.65535. This way Windows Installer will always consider the file in your MSI newer than what's installed on the target machine.