Install / Uninstall a Windows service in a build script using NAnt

Does NAnt have the ability to install or uninstall the Windows service using the InstallUtil utility or something else?

+1
source share
4 answers

You can call the Nant exec task to call InstallUtil and you can easily pass parameters to install or uninstall the service

 <target name="install-service">
    <exec program="${framework::get-framework-directory('net-2.0')}\InstallUtil.exe">
      <arg value="-i" />
      <arg value="/name=V1" />
      <arg value="C:\Service\SomeService.exe" />      
    </exec>
  </target>
+3
source

MSBuild? installutil - MSBuild. ( , , , , ).

, installutil, , , ( self install windows service)

+1

​​ , SC.EXE :

<property name="serviceName" value="Name of the service"/>
<exec program="sc" failonerror="false" verbose="true" if="${service::is-installed(serviceName,'.')}">
 <arg value="delete"/>
 <arg value="${serviceName}"/>
</exec>
+1

TopShelf Project , / InstallUtil.

Service ServiceName.exe Removing ServiceName.exe

And you can start the service directly and get a beautiful console window in which you can CTRL + C stop. You can integrate this directly into nant or msbuild by running the program.

0
source

Source: https://habr.com/ru/post/1723527/


All Articles