C Windows Service Installutil

C Windows Service Installutil Average ratng: 4,7/5 9061 votes

Download

Active2 years, 2 months ago

I have a standard.NET windows service written in C#. Can it install itself without using InstallUtil? Should I use the service installer class? How should I use it? I want to be able to call the. Sep 08, 2019  Installer Tool (Installutil.exe) The Installer tool allows you to install and uninstall server resources by executing the installer components in a specified assembly. This tool works in conjunction with classes in the System.Configuration.Install Namespace. You cannot use Installutil.exe to deploy a Windows service that was created by using C, because Installutil.exe cannot recognize the embedded native code that is produced by the C compiler. If you try to deploy a C Windows service with Installutil.exe, an exception such as BadImageFormatException will be thrown. To work with this scenario, move the service code to a C module, and then write the installer object in C# or Visual Basic. @MikeT I want to install the windows service named TestWindowService.exe in c # – MaviLe Jul 13 '17 at 11:07 add a comment 3 Answers 3. Installing the Windows Service using InstallUtil.exe using InstallUtil.exe from Command Prompt (Line) Once the Windows Service is build you need to find the EXE file in the Debug folder of the Project. Type c: windows microsoft.net framework v4.0.30319 installutil.exe your windows service path to exe Press return and that's that! It's important to open with administrator rights otherwise you may find errors that come up that don't make sense. If you get any, check you've opened it with admin rights first! How to debug the windows service is also included in the code. How to create and Install C# Windows Service. Step 2: Go to the folder “C: Windows Microsoft.NET Framework v4.0.30319” in the command prompt and call the installUtil.exe as shown in the figure below. Followed by the path of the LoggingService.exe which we got after.

My code:

Not Working

Error:

[ERROR:parse_cmd.bat] Invalid command line argument: 'cd'. Argument will be ignored. [ERROR:parse_cmd.bat] Invalid command line argument: 'C:Usersstajyer3DocumentsVisual'. Argument will be ignored. [ERROR:parse_cmd.bat] Invalid command line argument: 'Studio'. Argument will be ignored. [ERROR:parse_cmd.bat] Invalid command line argument: '2017ProjectsTestWindowsServiceTestWindowsServicebinDebug'. Argument will be ignored.

** Visual Studio 2017 Developer Command Prompt v15.0.26430.14 ** Copyright (c) 2017 Microsoft Corporation ********************************************************************** [ERROR:VsDevCmd.bat] * VsDevCmd.bat encountered errors. Environment may be incomplete and/or incorrect. *

mjwills
18.7k5 gold badges29 silver badges47 bronze badges
MaviLeMaviLe

3 Answers

you have made many mistakes here , with out knowing your objective its very difficult to say which is the worst

  1. ProcessStartInfo.FileName should be the file you want to executenot a start menu shortcut

  2. ProcessStartInfo.Arguments is a command line argument not acommand

  3. the command you are using seems to be an attempt to change theworking directory this should be done withProcessStartInfo.WorkingDirectory

  4. the strings you are using are broken because you are exiting thestrings by using ' but then you carry the string on, so i mustassume you mean the ' to be inside the string in which case you needto delimit them with this would then look like 'he said 'delimityour strings' 'though if you are using the @ notation then the delimiter becomes ' not '

  5. arguments are space separated strings so if your arguments containspaces such as long form filenames then you need to surround themwith quotes ' so ProcessStartInfo.Arguments = 'a b c:temp'; will pass the args 'a', 'b' and 'c:temp' to the executing program but ProcessStartInfo.Arguments = 'a literal string arg'; would pass each word as as separate argument ProcessStartInfo.Arguments = 'a literal string arg'; and this will pass in a single arg with the entire string

MikeTMikeT
3,5171 gold badge17 silver badges31 bronze badges

C Windows Service Installutil Home

You need to enclose the path in quotes (and escape the quotes around the filename)

David LindonDavid Lindon

Give this a whirl:

There is no need to involve the Developer Command Prompt - you can just invoke installutil directly.

Install Windows Service Installutil

mjwillsmjwills
18.7k5 gold badges29 silver badges47 bronze badges

Windows 10 Installutil

Not the answer you're looking for? Browse other questions tagged c#.netwindowsprocesscommand or ask your own question.