2

In a few days I'll be installing a Windows Service I developed on my development machine (which ultimately hosts a WCF-over-SOAP service) on a staging machine.

Since I have Visual Studio 2013, I can use VS command prompt to install that service using installutil.exe.

But target machine runs a plain old Windows Server 2008 R2

How do I install a .NET windows service on WS2008 that has no installutil.exe?

1

3 Answers 3

2

Unfortunately, as of Visual Studio 2012, Microsoft has deleted the "Setup Project" built-in feature of Visual Studio, in a move which I opine was a nod to their long-time business partner, InstallShield (owned by Flexera software). They removed this feature because they wanted to direct their customers to use hideously expensive third-party software to graphically build Windows Installers using InstallShield. Now, if you want to graphically design a setup project in Visual Studio 2012 or 2013, you must either:

  1. Download the free but extremely feature-limited "InstallShield LE", which constantly tries to upsell you to their extraordinarily expensive products, and is unable to do 99% of the useful things you might need it to do (highly un-recommended after trying this);

  2. Learn WiX and use the free WiX toolkit to build an installer (not particularly easy, but doable);

  3. Learn NSIS and use the free NSIS toolkit to build an installer (not particularly easy, but doable);

  4. Write a C# program that programmatically registers the service, per the example here on Stack Overflow. Your code will depend on the System.Configuration.Install assembly, which is available in the Client Profile (thankfully). See MSDN for details. This is perhaps the "simplest" way; you just ship your service as an EXE with a Main method...

3
  • To be fair to Microsoft their Setup Project was horrible and had a bug list about 3 pages long just for myself when I worked with it. The alternatives of WiX and NSIS are more complicated but don't nearly have as many problems. While its true was likely a decision to benfit their business partner it wasn't the only reason. Won't even mention the fact it didn't support any of the new system variables that were supported by VS2010 and .NET 4.0
    – Ramhound
    Mar 11, 2014 at 18:12
  • Any final sample windows service and installer (setup.exe, wix, etc) with full source code using VS 2012 ? Now, june 2014, any updates ? Notes: The install shield limited edition that cannot install services. The WIX Toolset, which, while powerful is exceeding user-unfriendly and has a steep learning curve. There is even a downloadable template for installing windows services.
    – Kiquenet
    Jun 9, 2014 at 12:27
  • It isn't our job to write complete samples for you. NSIS and WiX both have samples built into the (free) download. If for some reason you can't use that, you may need to consider the alternative of paying someone to do it for you. Jun 9, 2014 at 13:14
3

"InstallUtil" will exist on the server without Visual Studio being deployed, despite some documentation stating that it is installed as part of Visual Studio. Depending on your version of Windows and the .NET framework required, the "installutil" tool can be found here:

C:\Windows\Microsoft.NET\Framework\v4.0.30319\InstallUtil.exe C:\Windows\Microsoft.NET\Framework\v2.0.50727\InstallUtil.exe C:\WINNT\Microsoft.NET\Framework\v1.1.4322 installutil

Use the version matching the .NET Framework version that the service is targeting.

2
  • 2
    I suspect the downvote may have been from someone assuming I haven't answered the question. However, the premise of the question is that installutil will not exist on the server. I contend that it will, hence the premise of the question is wrong. I was left under the same impression by the documentation, only to find the reality was otherwise. I have edited the question to make it more obvious that this is the reason for the answer. Feb 8, 2019 at 17:00
  • Thank you for this! I didn't realize it was actually still there, but it is and is exactly what I needed. Apr 24, 2019 at 16:12
-2

Here you go:

  1. Install .net framework
  2. Go to run+ cmd then click ok or directly go to your window command prompt
  3. type

    cd C:\Windows\Microsoft.NET\Framework\v4.0.30319\InstallUtil.exe E:\test\test\bin\Debug\test.exe
    

    E:\test\test\bin\Debug\ is the path where my window service setup is saved, C:\Windows\Microsoft.NET\Framework\v4.0.30319\ is path where InstallUtil.exe exist. In both InstallUtil.exe exist. and path must give a space, otherwise it raises error.

  4. Enjoy..your service is installed...now you can check it from control panel > administrative tool >Services.
1
  • 1
    This is rather a duplicate of @JoshGallagher answer and goes against the scope of the question: installing a service on a machine that has no InstallUtil tools, for whatever reason Feb 7, 2019 at 13:01

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .