简体   繁体   中英

Visual studio 2010

Im creating a windows service using vs2010. I have been following tutorials and steps online of how to create a windows service. There is one step that is holding me back. I have researched many things and they all say the same way to create it. When it comes to installing the windows service, it asks me to right click on the grey area of service1.cs(design) and click add installer, however on my visual studio 2010 I do not have this option.

I have only seen one other person write on the internet that they have this problem and they said they 'repaired the install' to fix this, I carried out the same process but the option did not appear.

Please help!!

The best way to do this is to open the Service1.cs in design mode. Then, Right-click in the designer and select the Add Installer option. This adds a ProjectInstaller component along with the necessary assembly references. The ProjectInstaller component, in turn, has the service installer and service process installer added automatically.

The way Visual Studio offers windows service creation is just a whole lot of pain to work with.

I am going to suggest an alternate solution, which I think you should try out.

It is a open source project called TopShelf which allows you to run the service code as a console application while coding and debugging and when you want to install it as a windows service you simply run the exe with an /install option.

Have a look at their quick start guide . It doesn't get simpler than that.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM