Click here to Skip to main content
15,892,005 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I've created a windows service in c#, using Visual Studio 2013 I pretty much followed this:


HTML
http://www.c-sharpcorner.com/UploadFile/cb88b2/simple-steps-to-create-setup-file-using-install-shield-le-fr/


I created a setup project, as instructed in the article, and ran it. It installs my service to c:\program files(*86)\Company Name\My product Name etc., however, it does not then appear in the services list.

can you please help me What am i missing?


What I have tried:

I already tried to install this service manually using visual studio command prompt, and its working fine. But I am not able to install it using setup project which I created using Installshiled light edition which VS2013 provided inbuilt.
Posted
Updated 26-Jun-18 23:32pm
v3

Hi Varun, this does not specifically answer your question, but you may be interested to know that you can install/uninstall a windows service quite simply by using the following commands:

"C:\Windows\Microsoft.NET\Framework64\v4.0.30319\installutil.exe" "C:\Program Files\Service\Service.exe"

"C:\Windows\Microsoft.NET\Framework64\v4.0.30319\installutil.exe" /u "C:\Program Files\Service\Service.exe"

where v4.0.30319 is the version of .Net you are targeting for the service.

Many people have abandoned installer frameworks for windows services because they are heavy and not as easy to automate. It of course depends on your software and how/who it is being installed by.
 
Share this answer
 
Comments
Varun_nayak 24-Mar-16 4:34am    
sorry, i am rejecting this as a solution.

problem is this works only in my machine (which has visual studio) , not in client machine (which dont have visual studio or visual studio command prompt)
Matt Comb 28-Mar-16 10:06am    
Hi Varun, this is not correct. It works on all machines that have .Net installed you just need to either install the correct .Net version, or find which version of .Net is installed.
Matt Comb 28-Mar-16 10:07am    
The path above was for a specific version of .Net as I described: "where v4.0.30319 is the version of .Net you are targeting for the service."

The service you are creating must be targeting a specific version of .Net when it builds, you should use that version in the file path, and also consider the .Net may be 32 and 64 bit versions.
Varun_nayak 29-Mar-16 7:22am    
My application targeting .NET framework 4.5,
Both machines have .NET4.5 or above, both are 64 bit machine.
Even "C:\Windows\Microsoft.NET\Framework64\v4.0.30319\installutil.exe" this path available in both the machine.

PS: normally i have practice to install services using Visual studio Command prompt using installutil command, but for that machine should have visual studio and visual studio command prompt.

I am getting below error
Running a transacted installation.

Beginning the Install phase of the installation.
See the contents of the log file for the C:\Program Files (x86)\Emerson\My Product Name\LicenseServices.exe assembly's progress.
The file is located at C:\Program Files (x86)\Emerson\My Product Name\LicenseServices.InstallLog.

An exception occurred during the Install phase.
System.UnauthorizedAccessException: Access to the path 'C:\Program Files (x86)\Emerson\My Product Name\LicenseServices.InstallState' is denied.

The Rollback phase of the installation is beginning.
See the contents of the log file for the C:\Program Files (x86)\Emerson\My Product Name\LicenseServices.exe assembly's progress.
The file is located at C:\Program Files (x86)\Emerson\My Product Name\LicenseServices.InstallLog.
An exception occurred during the Rollback phase of the System.Configuration.Install.AssemblyInstaller installer.
System.IO.FileNotFoundException: Could not find file 'C:\Program Files (x86)\Emerson\My Product Name\LicenseServices.InstallState'.
An exception occurred during the Rollback phase of the installation. This exception will be ignored and the rollback will continue. However, the machine might not fully revert to its initial state after the rollback is complete.

The Rollback phase completed successfully.

The transacted install has completed.
Matt Comb 31-Mar-16 1:44am    
Sounds like you may have to elevate permissions... the user running that script needs to run it as admin
Open the window service class in design mode and Just set Account property of ServiceProcessInstaller to Local System from user . In case you did not add ServiceProcessInstaller kindly right click at Service design page and click on AddInstaller menu.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900