I made a setup file for c#.net application and installed it now when I restart the setup it is showing me the following error:
Another version of this product is already being installed. Installation of this version can not continue.
I want to create a setup with repair a option and somewhere I read that this repair option is provided by default then why I am not able to get that?
Need help, thanks.
What type of setup project have you used?
If you want your installer/setup to overwrite existing installation then you must increase the version number, every time you build installer project.
Version number consists of 4 parts 0.0.0.0 (Major Version, Minor Version, Build Number, Revision Number) but windows installer consider only first 3 parts so, make sure to increase the build number, every time you build a new installer.
If you run the same installer after installation was already completed successfully then it will ask you to remove the installation but if the installer is new but with same version number (you rebuild the installer project but did not change the version number) then you will get the in question message.
Select setup project in Visual studio > F4 > change the Version number (increase the build number by 1)
You can set the ARPNOMODIFY and ARPNOREPAIR properties
Related
I have made a msi project for my software in VS2015. I have made a.Net based desktop application. My requirement is that I would like to handle 2 cases :--
1- If our software is installed already, and user try to install it, it should automatically un-install existing software and delete database file (created by my application).
2- If installed version is lower then it should only uninstall application and leave my database file as it is.
Now in my setup project I have added Custom actions for install and un-install where I have given path of my dll and set Installer Class property to true. In this dll I have made a class inherited from System.Configuration.Install.Installer and handle Install , beforeInstall, uninstall like below :--
public partial class SetupManager : System.Configuration.Install.Installer
{
public SetupManager()
{
InitializeComponent();
this.BeforeInstall += SetupManager_BeforeInstall;
//this.Committed += new InstallEventHandler(DarkMailInstaller_Committed);
}
private void SetupManager_BeforeInstall(object sender, InstallEventArgs e)
{
MessageBox.Show("In Install event");
}
}
Now in un-install, I delete DB. it is working fine if I am un-installing from control panel and it removes my DB file as well.
But if I want to upgrade my product, before getting hit in my override function Like install or BeforeInstall it shows error "Another Version of this product is already installed. Installation of this version can not be continue. To configure or remove the existing version of product, use add/remove program of control panel".
Now I have searched on internet and it seems if I update my package code or product version, it should be able to install over it. Now I have following issues :--
1- In VS 2015, I dont have any property in setup project where I can set product version or package code ?
2- I have tried to edit it using Orca but even then if I try to install edited MSI file (with updated version number, package code and product code), I am facing same error.
3- I dont know why this this error is coming before executing Before-install event ?
4- I have found "RemoveExistingProducts" would be helpful in this case. But I can not find this property / action in VS2015. Where can I find it ?
Can some body please help me to solve this issue ?
In a Visual Studio setup project it's the RemovePreviousVersions property of the setup project, in with the other properties like Manufacturer, Version etc.
Increment the setup version's project version, accept the changes.
Set RemovePreviousVersions to true.
The UpgradeCode needs to be the same, so don't change it.
Increment the file versions of the binaries you need to be updated.
If you select the setup project in solution explorer and do F4 you should see the relevant properties.
Don't worry about PackageCode because Visual Studio creates a new one with every build, as it should.
Visual Studio custom actions all run after the files have been installed (despite the "before" name), so there's nothing you can do to influence the course of the installation. In any case you don't need them.
What you get is an MSI that will install as a fresh install to new customers. It will also upgrade an older product as it installs, and the Windows Installer overwrite rules mean that a data file updated by the application will not be replaced.
https://msdn.microsoft.com/en-us/library/windows/desktop/aa370531(v=vs.85).aspx
The generated MSI will have a RemoveExistingProducts sequenced towards the end of the install. Basically you don't need to worry about the internals of PackageCodes and so on because Visual Studio hides them.
I want my WPF application publish version. I tried using the answer for this question. It works but the problem is we can manually change the values there. I want to know how many times my project was actually published (don't need version number. Just how many times did I publish my application). Can this be done?
Using Click Once, each time you publish, Visual Studio will change the number automatically. It will increment the value each time you publish. Your problem is that you have manually changed the number. The solution is to publish and just let Visual Studio update the value... you should notice that your project needs to be saved once you have published. This is because Visual Studio just incremented the value for you.
UPDATE >>>
If you want to access the published version from code (which you should have made clear in your question), then you can use this code, but you have to ensure that the application is network deployed first... that means that it has actually been published, so it won't work while you are debugging. Try this:
private string GetPublishedVersion()
{
if (System.Deployment.Application.ApplicationDeployment.IsNetworkDeployed)
{
return System.Deployment.Application.ApplicationDeployment.CurrentDeployment.
CurrentVersion.ToString();
}
return "Not network deployed";
}
You may be confused by 2 sets of numbers. Please note that you can set version of your WPF app in TWO different places:
Project Properties / Publish tab / Publish Version
AssemblyVersion declared in AssemblyInfo.cs file, which you can find if you expand Project Properties node in Solution Explorer.
They are similar in the sense that they both provides 4 numbers: major, minor, build and revision. The difference is that Publish Version is only available if the app was actually Published (i.e. Installed). It is not available in your debug session nor if you just copy the executable to another machine and run it there. SO, if you just need to track version of your EXE file, use AssemblyInfo.cs.
Correspondingly, to read the data use the following code:
1 To read Publish version (declared in Publish tab)
using System.Deployment.Application;
ApplicationDeployment.CurrentDeployment.CurrentVersion.ToString();
Note that in this case: a) you need to add reference to System.Deployment assembly, b) if the app was not deployed, it won't work.
2 To read Assembly Version (declared in AssemblyInfo.cs)
Assembly.GetExecutingAssembly().GetName().Version;
This one always works.
Universal solution if we get application version from not startup assembly:
var version = System.Reflection.Assembly.GetEntryAssembly().GetName().Version;
string appVersion = $"{version.Major}.{version.Minor}";
GetEntryAssembly give version of startup project.
var obj=Assembly.GetExecutingAssembly().GetName().Version;
string version= string.Format("Application Version {0}.{1}", obj.Build, obj.Revision);
OR
string version= string.Format("Application Version {0}.{1}", obj.Major, obj.Minor);
whichever properties suits you.
i have developed a software last year the version is 2013(CB2103)in WPF with Visual Studio ,now i need create from the same project the version 2014 ,it is simple just i need to change name of the file.exe (from CB2013 to CB2014) but when i change the name of the Assembly Name from CB2013 to CB2014 then deploy it and when installing appear an Error that say already there is the same version of the software installed on the computer ,sincerely we need both version installed on the computer then do you have any tips or idea how to work out this issue?
Thanks so much for your attention
If you're using a "Setup Project", then you need to generate a new GUID for the Product Code...so that it allows it to be installed as a distinct instance (rather than forcing you to uninstall the previously installed one, or upgrade).
Also optionally you probably want to update the attributes (AssemblyTitle, AssemblyDescription, AssemblyProduct, etc) in your AssemblyInfo.cs file, so that you name it CB2014 instead of CB2013.
I have created a setup project for Windows Application . I have set following property to replace the existing version with the new version.
RemovePreviousversion=True;
Productcode=change;
But when I run exe from new installed version. I cannot see my new updates. It gives me the output of previous version!
The whole Explanation is Here
I have RemovePreviousVersions set to TRUE and InstallAllUsers set to TRUE.
When I need to do a new release, I update the Version field with a new version number in the installer and VS prompts me to update the product code, to which I answer YES. I have verified that it does indeed change the product code, but the package code also gets changed with it (verified by diffing project files using sourcesafe).
The UpgradeCode never changes between versions.
My version number changes are of the form: "1.1.2" -> "1.1.3" for example (just in case that has anything to do with it).
So only 3 fields are different between builds: ProductCode, PackageCode, and ProductVersion.
When I've done all that, I build the installer.
When I install the new version (I always install for all users and always into the same directory), I have seen three different results at various times:
It will appear to in install the new version, but I really end up with the old files still there (and one instance in the add/remove programs).
I end up with 2 instances of the app in the add/remove programs, both with the same name, and both pointing to the same directory.
It will uninstall the old one first and then install the new one (what it is supposed to do).
It is very frustrating to explain to users that to be safe, they have to uninstall the old manually before installing a new release because I have to tell them "it doesn't always uninstall the old one like it is supposed to".
Any suggestions? Why isn't this working? What am I missing here?
I Found answer.
Also need to change AssemblyVersion and AssemblyFileVersion in AssemblyInfo.cs
I making a program and wanted to make an update function... So lets say I make one update and put it on my dropbox.. When someone click on update, the program will check if there any file with different name (no same version) on the server and if there is, then start to download it.. Is it possible?
And my second problem I installed my program on my computer but when start the installer again it says:
Another version of this product is already installed. Installation cof this version cannot continue. To configure or remove the existing version of this product use add/remove programs on the control panel.
I want when I run second time installer a confirmation message appear if he want to delete previous version to install this one (I need this for the update)
You could create a web service that provides an index / manifest of a directory that you want to synchronize. The web service could also provide methods for uploading and downloading the synchronized files and folders.
If you are using a Visual Studio Setup Project (.msi) you can simply change the installer version. Visual Studio sees the change and asks you if you want to change the product code. You would say 'yes'. The installer should then remove previous versions before installing the latest. You would also want DetectNewerInstalledVersion = true and RemovePreviousVersions = true.
Not sure if it works for this scenario but you may want to look at a ClickOnce deployment. It may solve both of your problems. ClickOnce Deployment