VS Setup Project - how to remove files post installation? - installation

I am creating a installer for my application using VS Setup Project. Everything works great, but the issue is, whatever files or extra DLLs I used are present in the Application folder, which I want to remove so that my folder contains only files are required by it and not by the installer. I have been searching for a way to achieve this, but I am unable to find one.
So is there any way to remove extra DLLs, text files, that were used by installer, after the installation of application. ???
Or
is there any special folder in which we should keep Dlls used by installer so that they are automatically removed once installation is completed or machine is restarted ???
I am really confused in this, as it looks to me a very common requirement of removing temporary files that are only used by installer, after installation is completed.

The setup project installs whatever you added in Application Folder from File System Editor.
If you are using a project output, remove it and add your application files manually. If you added the files manually, remove the ones you don't want installed.

Related

Visual Studio Setup Project: How to delete all legacy files and folders in target folder before install my application?

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.

Visual stuio web deploy package

I am using vs 2015 update 3. In order to deploy my website, I create a web deploy package from the publish menu.
When I deploy that package, sometimes, some of the dll's are corrupted. When I ran the app I get an error that the dll is missing. When I open the dll with a disassembler, it is marked as an unmanged dll.
I can't find any difference between projects that work finק and the one's that don't, or between the dll that is fine and the one that is not.
I also tried deploying from VS Straight to my local IIS but that didn't help either.
What could this be?
After lots of debugging I found the problem.
In order to change variables in different environments we use parameters.xml file to set up the variables. There we had a settings to run on all js files and replace url's. The dll that was getting corrupted was newtonsoft.json.dll. since there is ".js" in the file name, the dll was beeing manipulated as well.
The solution was in the parameters.xml file to change the setting to be .js$. In that case it look for files that end with .js only and not all files.

Cannot include duplicate files in msi installer

I'm using Windows 7 64, VS 2013.
I'm trying to create an MSI installer that contains 2 C# applications distributed in 2 different folders, both folders are containing 1 DLL file that is the same. I am adding all necessary dependencies, everything seems fine, but after installing, one of the applications throws an error regarding loading of that DLL.
My assumption is that the VS installer project keeps the files in a common folder and when it sees the same file it automagically refers both application to use the same exact DLL.
My work-around for this problem is to rename the DLL when adding it into installer project and make a small .bat script that renames the DLL after installation. This works, but I'm guessing there's a more elegant way to do it besides having scripts run at install/uninstall time that will rename some DLLs.
Strictly speaking, Windows Installer has something called the component rules. One aspect of this is that a given file in a given folder can only belong to one component. The same files in two different folders would be two different components because a component can only define files for one folder.
WiX creates MSI and has a feature called smart cabbing where the file would be normalized when compressed into a cab and embedded into the MSI.
Visual Studio installer projects are of very low quality and will killed by Microsoft before being brought back to live as an add on. It has horrible dependency scanning and you are finding that the "automagical" behavior doesn't work very well.

How to include arbitrary files in a .NET setup project

We have a folder of text files that needs to be copied to the server whenever our application is deployed. Currently, we handle this by manually copying/pasting the folder's contents.
How can I include this as an automated step in the MSI?
I want the folder (and it's contents) to be included in the MSI. Then, on install, I want to the files in the MSI to overwrite the existing files (in a given local directory).
The files are in source control (TFS), but they are not part of any .NET project.
I've used the Nullsoft Installer before (among others), and that's basically all it does (you tell it what files to pull in and where to put that at install time). Visual Studio automates a lot of this... but I just can't see where to do the basic task.

Visual Studio Installer not overwriting files in target application directory

I have a Visual Studio 2008 solution that contains several projects.
Most projects in this solution write a .dll when built.
My installer project in this solution copies these .dlls to a target application directory.
My uninstaller for this solution does not remove these .dlls, even though it should.
My installer doesn't overwrite old versions of existing .dlls, which causes my application not to function.
If I delete the existing .dlls prior to install, the application works well.
I've monkeyed with many many settings in the solution for these .dlls. Nothing seems to work.
I've added extra copy actions to the install project, in an attempt to overwrite existing .dlls. A couple of these extra copy actions can not be deleted, because the delete choice is disabled from the drop-down list when I right-click on them. Weirdly, the original detected dependencies can be deleted.
Any ideas are most welcome.
Thanks,
-Vince

Resources