setup and unistall
-
hi all, I wrote a service in c# and I prepared a setup to service but now I want to unistall if service install before and then install last setup how I do this?? thanks..
-
hi all, I wrote a service in c# and I prepared a setup to service but now I want to unistall if service install before and then install last setup how I do this?? thanks..
So you want to do an upgrade?? I will assume you have used a VS Setup project for doing this. If you want your service to be updated and you use VS2008. Do the following: Add a custom action for Install, Commit, Rollback and Uninstall and add "Primary output..." of your service project. Add the Condition
NOT PREVIOUSVERSIONSINSTALLED
for Install and Commit. In your Setup-project chooseRemovePreviousVersion: True
and change theUpgradeCode
andVersion
. IF you are using VS2005 you don't have to add theNOT PREVIOUSVERSIONSINSTALLED
as a Condition. This was altered in VS2008. I also assumed that you added aProjectInstaller
to your service project :) -
So you want to do an upgrade?? I will assume you have used a VS Setup project for doing this. If you want your service to be updated and you use VS2008. Do the following: Add a custom action for Install, Commit, Rollback and Uninstall and add "Primary output..." of your service project. Add the Condition
NOT PREVIOUSVERSIONSINSTALLED
for Install and Commit. In your Setup-project chooseRemovePreviousVersion: True
and change theUpgradeCode
andVersion
. IF you are using VS2005 you don't have to add theNOT PREVIOUSVERSIONSINSTALLED
as a Condition. This was altered in VS2008. I also assumed that you added aProjectInstaller
to your service project :)"Add the Condition NOT PREVIOUSVERSIONSINSTALLED for Install and Commit. In your Setup-project choose RemovePreviousVersion: True and change the UpgradeCode and Version" how I add NOT PREVIOUSVERSIONSINSTALLED condition and choose RemovePreviousVersion where is it??
-
So you want to do an upgrade?? I will assume you have used a VS Setup project for doing this. If you want your service to be updated and you use VS2008. Do the following: Add a custom action for Install, Commit, Rollback and Uninstall and add "Primary output..." of your service project. Add the Condition
NOT PREVIOUSVERSIONSINSTALLED
for Install and Commit. In your Setup-project chooseRemovePreviousVersion: True
and change theUpgradeCode
andVersion
. IF you are using VS2005 you don't have to add theNOT PREVIOUSVERSIONSINSTALLED
as a Condition. This was altered in VS2008. I also assumed that you added aProjectInstaller
to your service project :)I found them and I did them but it is not work I unistall service "sc delete servisname" from command prompt ,is it necessary tu use this command?
-
I found them and I did them but it is not work I unistall service "sc delete servisname" from command prompt ,is it necessary tu use this command?
No not really. Just to make sure I understand your question correctly, is this your scenario: You have created a Windows Service (NT Service) and you have added a
ProjectInstaller
in that project. You added a Setup project to your solution to install your Windows Service. Now you want to make an upgrade of your Service, for instance upgrading from version 1.0 to 2.0. Then you should do the following: 1. Create a Custom action to your Setup project for Install, Commit, Rollback and Uninstall, adding theProject Output..
of your Windows Service. 2. ChangeRemovePreviousVersion
fromfalse
totrue
. 3. Change theVersion
of your Setup project (i.e. from 1.0 to 2.0). 4. Change theUpgradeCode
of your Setup project (I believe VS asks you if you want to change this when you change theVersion
). 5. If you are using VS 2008 (or 2010?), add theNOT PREVIOUSVERSIONSINSTALLED
as aCondition
. If you are using VS 2005, this is not necessary (Microsoft changed this behaviour between the 2005 and 2008 version of VS. This means that in 2008 the Service will not really be uninstalled in the Service Control Manager - only the binaries will we changed). I know i repeated myself a bit from my previous answer, but this is actually the only steps you need to go through to make it work. If it doesn't work - please provide the code in yourProjectInstaller class
, because maybe something is missing there. Also provide any error messages displayed. You should not have to make any commands like "sc delete servisname" etc. All this should be taken care of by MSI. -
No not really. Just to make sure I understand your question correctly, is this your scenario: You have created a Windows Service (NT Service) and you have added a
ProjectInstaller
in that project. You added a Setup project to your solution to install your Windows Service. Now you want to make an upgrade of your Service, for instance upgrading from version 1.0 to 2.0. Then you should do the following: 1. Create a Custom action to your Setup project for Install, Commit, Rollback and Uninstall, adding theProject Output..
of your Windows Service. 2. ChangeRemovePreviousVersion
fromfalse
totrue
. 3. Change theVersion
of your Setup project (i.e. from 1.0 to 2.0). 4. Change theUpgradeCode
of your Setup project (I believe VS asks you if you want to change this when you change theVersion
). 5. If you are using VS 2008 (or 2010?), add theNOT PREVIOUSVERSIONSINSTALLED
as aCondition
. If you are using VS 2005, this is not necessary (Microsoft changed this behaviour between the 2005 and 2008 version of VS. This means that in 2008 the Service will not really be uninstalled in the Service Control Manager - only the binaries will we changed). I know i repeated myself a bit from my previous answer, but this is actually the only steps you need to go through to make it work. If it doesn't work - please provide the code in yourProjectInstaller class
, because maybe something is missing there. Also provide any error messages displayed. You should not have to make any commands like "sc delete servisname" etc. All this should be taken care of by MSI.thanks for your answers,you understand correctly my problem my projectinstaller class only like this: namespace SistemServis { [RunInstaller(true)] public partial class ProjectInstaller : Installer { public ProjectInstaller() { InitializeComponent(); } } I added aproject installer but I didn't add anything else. Do I have to write different things???
-
thanks for your answers,you understand correctly my problem my projectinstaller class only like this: namespace SistemServis { [RunInstaller(true)] public partial class ProjectInstaller : Installer { public ProjectInstaller() { InitializeComponent(); } } I added aproject installer but I didn't add anything else. Do I have to write different things???
Okay, then that's your problem. You have to add code to the
ProjectInstaller
class that actually does the installation of your service. In your case it would look something like this (from MSDN example):namespace SistemServis
{
[RunInstaller(true)]
public partial class ProjectInstaller : Installer
{
private ServiceInstaller serviceInstaller;
private ServiceProcessInstaller processInstaller;public ProjectInstaller() { InitializeComponent(); processInstaller = new ServiceProcessInstaller(); serviceInstaller = new ServiceInstaller(); processInstaller.Account = ServiceAccount.LocalSystem; //or the account you wish to use serviceInstaller.StartType = ServiceStartMode.Manual; //or the mode you wish to use serviceInstaller.ServiceName = "YourServiceName"; //name of your NT service Installers.Add(serviceInstaller); Installers.Add(processInstaller); }
}
}Good luck!
-
Okay, then that's your problem. You have to add code to the
ProjectInstaller
class that actually does the installation of your service. In your case it would look something like this (from MSDN example):namespace SistemServis
{
[RunInstaller(true)]
public partial class ProjectInstaller : Installer
{
private ServiceInstaller serviceInstaller;
private ServiceProcessInstaller processInstaller;public ProjectInstaller() { InitializeComponent(); processInstaller = new ServiceProcessInstaller(); serviceInstaller = new ServiceInstaller(); processInstaller.Account = ServiceAccount.LocalSystem; //or the account you wish to use serviceInstaller.StartType = ServiceStartMode.Manual; //or the mode you wish to use serviceInstaller.ServiceName = "YourServiceName"; //name of your NT service Installers.Add(serviceInstaller); Installers.Add(processInstaller); }
}
}Good luck!
:( nothing changed when I tried to install, service all times give this error: error 1001:the apperred system is still there.
-
:( nothing changed when I tried to install, service all times give this error: error 1001:the apperred system is still there.