How to make Visual Studio Installer remove file during installation? - visual-studio-setup-proje

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?

Related

How to update web-installed Microsoft Visual Studio 2017 offline (saved layout)?

I have Visual Studio 2017 which was installed from the web.
Meanwhile, the corporate firewall rules changed and it's no longer possible to update the installation (download.visualstudio.microsoft.com is blocked).
At home I was able to download a complete Visual Studio 2017 layout to an external drive.
Now, how can I instruct Visual Studio Installer to use the external drive layout instead of trying to download from the web?
After googling a bit, I found some clues here and there, but never got a direct answer. I had to do some experiments until I found a very simple solution:
Open folder C:\ProgramData\Microsoft\VisualStudio\Packages\_Instances (or equivalent in your machine). This folder should contain a subfolder with the VS2017 instance GUID (from now on referred to as VS_GUID). Note: ProgramData is a hidden folder.
(Optional) Create a backup of file C:\ProgramData\Microsoft\VisualStudio\Packages\_Instances\{VS_GUID}\state.json in another directory of your choice.
Edit file C:\ProgramData\Microsoft\VisualStudio\Packages\_Instances\{VS_GUID}\state.json (note: VS_GUID is the sub-folder name found in step 1)
and change layoutPath to your local layout folder and installChannelUri to the full path to ChannelManifest.json (which should be present in the layout folder root).
Example (when layout path is D:\vs2017layout):
(...)
"layoutPath":"D:\\vs2017layout",
"installChannelUri":"D:\\vs2017layout\\ChannelManifest.json"
(...)
Save state.json and launch vs_professional_xxxxxxxxx.yyyyyyyy.exe (or equivalent) which is located in the layout folder. If it detects the updated installation files then the "download" progress should move to 100%.
This worked for me.

Visual Studio 2015 Update 3 installation failed

I have a problem with installation Visual Studio Professional 2015 Update 3. I don't know what cause the problem, but setup is failed every time in each setup configuration. Setup manager shows me following error and warning:
Microsoft Visual Studio Services Hub
The system cannot open the device or file specified
I really don't know how to solve this problem. Does anyone know what is wrong and how can I install this program?
Greetings
SOLUTION
I know what was the problem! I didn't check thoroughly the default location where Visual Studio wants to install. On my PC I have installed a 64-bit Windows 7. After many tries of installation I saw that installator chose wrong Program Files folder. It tries to install Visual Studio in Program Files (x86) (dedicated for 32-bit programs). I really don't know why VS installator chose a default folder for a 32-bit programs while my VS is a 64-bit version and also Windows is a 64-bit version.
I hope that this solution will help someone who has the same problem.
Most likely this is because of Windows Installer cannot access the %TEMP% folder (I had similar error once, but with MSSQL setup). So:
First of all check if you %TEMP% environment variable points to the
right location
Then check if the account which is running VS setup has privileges to
access TEMP folder. Better yet, make sure you run setup as
administrator
Finally make sure you have disabled all disk or folder encryption
features
Also just to be sure disable any antivirus software you have running
The error message “The system cannot open the device or file specified” often related to the specific folder is encrypted, you can have a look at this article and try the following methods:
Save the VS installer file to a folder that is not encrypted
Install the VS to a folder that is not encrypted
Turn off encryption on the %temp% folder
To check the encryption of the specific folder, you can right click the folder and select ‘Properties’— ‘General’ tab, click ‘Advanced’ button and confirm the checkbox of ‘Encrypt contents to secure data’ is checked or not.
You can click the ‘log file’ in the VS installer screen that you shared, and find the specific folders that these 2 components ‘Microsoft Visual Studio Services Hub’ and ‘Visual C++ IDE Common Package’ stores and check if those folders are encrypted or not.

Publishing windows application without delete file

In my windows application, there's a file (option.xml) created by my application on the user's computer. It's created run-time with option selected by the user.
This file is in the bin directory.
When I make a new release, the installation (that I make publishing to a shared directory with visual studio wizard) delete this configuration file, so the user have to save the option again.
How can I publish a new release without delete this file?
I'm using visual studio 2013
I hope that the issue is clear.
thanks

visual studio setup project updating at same location?

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.

Visual Studio Setup project should not delete file during uninstall

I created Visual Studio 2005 Setup project for my application. Windows Installer during installation put one xml file into AppData/myCustomFolder. I used File System Editor and added special folder - user's app data folder, then included that xml there.
When I uninstall application from Control Panel folder from Program Files is deleted, but also my xml file from AppData is deleted too. I need to leave this xml file in the AppData always, even when user re-install application.
How I could do it?
Set the Permanent property to True
Permanent Property

Resources