I have created a successful deployment project using Windows Fourms that work as intended but there are two things that need to be solved:-
First: I have to click the setup.exe file in order for the installation to check for the perquisites, and if click the setup.msi it proceeds to install the software directly without checking anything.
Second: When i click on the setup file while the software is already installed on my PC, i get an error message "Another version of this product is already installed. Installation of this version cannot continue. To configure or remove the existing version of this product, use Add/Remove Programs on the Control Panel" while i should get a Repair and Remove options.
Can anybody help me solve this problems ?
As said by Morten, that's how it works. You want to make sure that the prerequisites are (get) installed before your product is installed.
This probably is caused by a rebuild of the deployment package after you installed it. Windows installer notices that you use a different MSI (with a different package code), that contains the same product version. This situation, apparently, is inconclusive enough to leave it up to you what to do with it. The logic of this, I think, is to prevent a "Repair" that in fact installs a different product. Inconvenient for testing, but very much desirable in production environments. If you try to install the same MSI you should get the repair/remove options.
BTW, after building a release, you can right-click the setup project in VS and choose "install". This executes a setup that kindly removes a previous installation with the same version.
Related
I'm using Visual Studio 2017 with the Installer Projects extension to make an MSI for my app.
However, when I run the, say 0.2.7 MSI on a system with 0.2.5 already installed, it adds another item to the appwiz.cpl, and leaves the version the same, so that after the 0.2.7 install, it just runs the 0.2.5 exe.
I make sure that the UpgradeCode is the same, the PackageCode and ProductCode are changing with each version and I have RemovePreviousVersions set to true.
My source code is available here. You'll find the installer project in ChromebookGUI/Installer/.
What am I doing wrong?
You can get a list of upgrade codes for installed packages like this: How can I find the Upgrade Code for an installed MSI file?
I have another one that is a bit simpler, but I couldn't dig it up right now. I will have a look later.
Adding this answer to "evolve" it if you provide more follow-up information (to avoid too many comments).
UPDATE: the other answer is here, but I wouldn't recommend that script if you have automatic logging enabled since it will create log files in the temp folder when run.
I developed a windows service in C#. and my project has Installer, and Setup project.
the setup project, installs service very well and it doesn't have any problem, but when I change project and create other setup, the new setup doesn't install new service, because it's already exist!!!
is any way to create setup that it uninstalls the service then install it?
The problem is that upgrades in VS2008 setups and later use installer classes and an install sequence which is 1) Install newer product over older product, use file version checking, run install custom actions 2) Remove the old product running uninstall custom actions and getting rid of files that are no longer used. VS 2005 wasn't like this. So the installer class custom action that installs the service is running when the service already exists. Sometimes you can revert to the VS 2005 upgrade mechanism that removes ALL the older installed files first, including databases etc, so keep that in mind. You can do that by modifying the MSI file with Orca, InstallExecuteSequence table, and re-sequence the RemoveExistingProducts action to immediately after InstallValidate. Otherwise do both these:
Always install the service binary to a fixed location (that means not the browsable Program Files folder). The uninstall custom action for the service should have a condition of NOT UPGRADINGPRODUCTCODE so that an upgrade doesn't try to uninstall it (but a straight uninstall will). It needs to be in a fixed location because this upgrade solution doesn't install or uninstall the service - it just updates the binary - but obviously you don't want service entries referring to a service that has changed location.
In the upgrade have a condition of NOT PREVIOUSVERSIONSINSTALLED on the install custom action for the service. This means it will not try to re-install the service (which is why you get the "already exists" error) but it will update the exe if you have incremented its file version.
If you search the MSDN setup forum http://social.msdn.microsoft.com/Forums/en-US/home?forum=winformssetup for PREVIOUSVERSIONSINSTALLED many of the posts are to do with this issue and there is more discussion and explanation.
Editorial: Installer classes are not required because Windows Installer can do all this for you, which is why this is only ever an issue with VS setup projects. Moving to a tool that uses MSIs ServiceInstall and ServiceControl tables will get you out of the need for any code to install/uninstall/stop/start services.
You could do it by properly configuring MSI properties. Click on Installer project and press F4 to view MSI's properties window.
When you go to properties you could see two type of properties that are Upgrade code and Product Code. Every Time you create/release a new Windows service installer make sure to keep the same Upgrade code but change the Product Code.
Change DetectNewerInstalledVersions property to true.
Set RemovePreviousVersions to true.
Now Change the version number to a higher version from previous release, if your previous release version was 1.0.2, change the new version to 1.0.3.
When you install a MSI with abovementioned settings, MSI will check if any other product installed with same Upgrade code, if it finds a product then it will check if the new installation has a higher version. If all the conditions are satisfied it will first remove the existing(Older) version and install the newer version.
I'm very new to Setup project in Visual Studio, I've just tried creating a one, it deployed my files as I configured in the setup project. But after testing the install file (.msi), there was something I can't understand:
There is no entry in the Add/Remove programs list in Control Panel but I tried re-running the setup and it showed a dialog saying that I couldn't setup because there was another version which has already been installed in the target computer, I should uninstall that version first, but I couldn't find an entry in Add/Remove programs and there is also no uninstall.exe file. I tried searching for all entries which contains my application executable file name in Registry and deleted these entries but It still shows me that dialog. (There must be some way through which it can detect another version installed on the target machine).
How I create an uninstall.exe for my deployed application in Setup project??? I thought it should be created automatically for me when I build my Setup project.
Your help would be highly appreciated. Thanks.
There is no uninstall.exe when you are using msi packages to install applications. If you double click the msi of an already installed application you get the choice to do a repair or an uninstall.
What name did you give to your installation package? Maybe you left the default name or gave it some "weird" name different from your application and that's why you can't find it. In 7 you can sort the installed programs by install date and check what's been installed last, don't remember if it's possible in XP.
I have an application I want to build and deploy via ClickOnce. But we want this to be a process that can be run outside of VS through scripts, for either test, business UAT or production environment.
Each separate environment requires a different .config file to be used and a different web server to be deployed on and for update location.
The application also has prerequisites of .NET runtime 3.5 and Crystal reports.
I have looked into using MAGE to create application and deployment manifests, and if I do a code BUILD, then use MAGE afterwards as per each environment, as well as having the script copy over the correct .config file, this creates what I think are the correct manifests for each environment at the time of running the script.
But what I'm struggling to do is include the prerequisites. If done through VS, you can specify a setup.exe package which gets built with the pre-reqs and deployed alongside the application and when you click on the download link, it installs the pre-reqs from setup.exe and then the application.
But how can I do this manually outside VS? I can build the setup.exe through VS with the right URl location but then how do I link the setup.exe to the application as a pre-req using MAGE to generate the manifests?
The problems we have are 1) The users do not have admin rights to download and install packages, only to install things via clickonce so the pre-reqs have to be installed under the click once security umbrella.
Thanks
ClickOnce and prereqs cause lots of confusion. The setup.exe that Visual Studio generates has nothing to do with ClickOnce. The only minor link between the two is that the setup.exe will launch the ClickOnce application once it finishes. That's it. So thinking users will be able to install your prereqs "under the clickonce security umbrella" is a mistake. If they are not an admin and a prereq install requires admin privileges, they won't be able to install it.
My advice would be to generate your setup.exe one time. You shouldn't need to keep doing it unless your prereqs keep changing. Use Visual Studio, generate the setup one time, then use Mage for the rest.
Edit
In general you make the setup.exe available and depend on the user to know if they need to run it or not. If they already have the prereqs and run the setup.exe, nothing bad happens. It sees that everything is installed then launches the app.
Usually you're going to direct users to run the setup.exe. The next time they want to launch the app they should use the start menu shortcut (assuming you didn't go with "Online Only"). I've found this to be the least confusing set of instructions for users.
Remember how Visual Studio does extra, non-ClickOnce stuff when you publish (like the setup.exe)? It also creates a simple html page that has links to both the ClickOnce manifest and the setup.exe and an explanation. It also has some javascript that checks the UserAgent string to determine if they have the .NET Framework installed. Again, this isn't ClickOnce. It's just something nice Visual Studio does for you. If you like it, use it. I kind of like skipping it and going with the run setup.exe to install then launch from the start menu.
codeConcussion is right, you can't ever actually have the prerequisites instill directly from ClickOnce. You should just generate it once and then you have it ready for your external ClickOnce tool.
There is an option other than Mage. You could use my companies tool, ClickOnceMore, as your ClickOnce build software. It's been designed for people who want to use ClickOnce but don't want to build with Visual Studio.
It can hook into the setup.exe generated from Visual Studio (details here) so should satisfy all your needs.
Why do you want to build setup manually if everything can be done via clickonce ?
You can select "Download pre-requisites from same location" option from prerequisites form if you want to include .netfx or crystalreports, download bootstrap packages for .netfx3.5 & crystalreports and add to folder (for windows 7) "C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bootstrapper\Packages" . The deployment project will automatically include netfx & other packages along with setup.exe.
hope this helps.
I have created VS installer in VS2010. it works fine. when the program is already installed and you re-run the installer it would prompt for repair and uninstall. this is good. the problem is when I re-build the same exact installer and try to install it on a machine that already has one installed it would not give me the prompt repair and uninstall. Instead it gives me pop up error "Windows Installer: Another version of this product is already installed. Installation of this version cannot continue...." then it asks me to do manual uninstall using Add/Remove program from Control panel.
So there is gotta be something changed/auto generated during the re-build. kind a like key or something that is different from the older version which makes the newer one fails to recognize the older version. anybody knows how to handle this?
increment your setup project version and set
- DetectNewerInstalledVersion = true
- RemovePrevousVersions = true
more info : http://social.msdn.microsoft.com/Forums/en/winformssetup/thread/717cfce0-3061-400f-9ea3-069f73f3a473
If you increase the version it will automatically detect the previous version and handle it as per your configuration on RemovePrevousVersions and DetectNewerInstalledVersion.
On the properties on the VS Setup project set the RemovePreviousVersions to True. I believe by default it is set to false. I beleive that would save some time instead of doing it manually.
Also, there is an ProductCode, UpgradeCode, and Version in these properties. These control installation behavior, more information is here:
http://msdn.microsoft.com/en-us/library/aa372845(v=VS.85).aspx
Here are more details:
http://msdn.microsoft.com/en-us/library/aa370579(v=vs.85).aspx