Change name application - c#

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.

Related

How to uninstall automatically while installing new version in msi file

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.

Repair set up option in setup installation?

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

How to get installed applications install folder(path) and uninstaller

Hello I need some way of finding all the insllaled applications on windows(I already found the names but i need the actual folder). Also I need the path to their uninstaller.
I'm trying to build an application that is similar with Advanced Uninstaller pro.
PS. I need to do this in C#.
I think you wont need the path to the installer, you have to get the UninstallString value for each installed application so you can excute it once wanted to be removed. All of them are available here : HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall (my case is 64bit system)
You can enumerate all apps from here by getting DisplayName value. Hope it helps

c# Check if there is a file on server with specific name

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

How to find a Windows Forms Application's Product Code?

I need my application to uninstall itself.
Reason: It's come to my attention that my app is destroying its own files (my bad), but the user of my app doesn't understand why he needs to uninstall it and refuses to uninstall it. However, he still complains about the constant problems. And in the Terms Of Use, there is a line that says "...we reserve the right to remove the application from your computer and temporarily or permanently discontinue your use of the software."
So, I did some searching on how to uninstall a program, (which will be replaced by a new version), and came across Uninstall C# windows application from self and the accepted answer says you need a 'product code'. What exactly is that, and where can I find/get it from? I have searched for this but can't find anything.
Thank you
The productcode can be obtained from your MSI by opening with orca, the msi db editor and lookup the productcode in the Property table. Orca is part of the Windows SDK.
You can also run your msi
msi /i [your msi] -lvx* log.log
and harvest the productcode from the log.
The easiest way is by getting it from the author files of your setup as Ken White already pointed out.
You created the product code (if it exists) when you created your MSI to install your application. You need the same product code you used in the installation in order to uninstall it via Windows Installer.
I am not sure about VS 2010, but in VS2008 setup projects have a ".vdproj" project file, which can be opened with a simple text editor (like notepad). If you search for the word "ProductCode", you will find a line like
"ProductCode" = "8:{GUID}"
(the GUID is what you are looking for).

Categories