Windows Service Class

Feb 19, 2014 at 4:02 PM
I am trying to run a net stop iisadmin /y from the windoes service class. One of the properties in the documentation is CommandLineArgumnets. When I try to use this i get an eeror message indcating it is not supported.


<Target Name="StopIISADMIN">
    <MSBuild.ExtensionPack.Computer.WindowsService TaskAction="Stop" ServiceName="iisadmin" CommandLineArguments="Y" MachineName="Server"/>
</Target>

Is there a way I can run this from the windows servcie class?

Help!!!!!

Regards
Coordinator
Feb 19, 2014 at 10:48 PM
Edited Feb 19, 2014 at 10:49 PM
What version are you using?

According to the help, CommandLineArguments is not supported for Stop

Stop (Required: ServiceName or Services Optional: MachineName, RetryAttempts)

But you shouldn't get a not supported error using the code you have provided.

Can you provide your exact error message.

Mike
Feb 20, 2014 at 2:46 PM
I'm using version 4.0. So what you are saying is I cannot use it.

Error message is:

Build started 2/20/2014 9:40:40 AM.
Project "C:\Nick\Build_01.proj" on node 1 (StopIIS target(s)).
C:\Nick\Build_01.proj(171,93): error MSB4064: __The "CommandLineArguments" parame
ter is not supported by the "MSBuild.ExtensionPack.Computer.WindowsService" tas
k.__ Verify the parameter exists on the task, and it is a settable public instanc
e property.
C:\Nick\Build_01.proj(171,5): error MSB4063: The "MSBuild.ExtensionPack.Compute
r.WindowsService" task could not be initialized with its input parameters.
Done Building Project "C:\Nick\Build_01.proj" (StopIIS target(s)) -- FAILED.


Build FAILED.

"C:\Nick\Build_01.proj" (StopIIS target) (1) ->
(StopIIS target) ->
C:\Nick\Build_01.proj(171,93): error MSB4064: The "CommandLineArguments" para
meter is not supported by the "MSBuild.ExtensionPack.Computer.WindowsService" t
ask. Verify the parameter exists on the task, and it is a settable public insta
nce property.
C:\Nick\Build_01.proj(171,5): error MSB4063: The "MSBuild.ExtensionPack.Compu
ter.WindowsService" task could not be initialized with its input parameters.
0 Warning(s)
2 Error(s)
Time Elapsed 00:00:00.80
Coordinator
Feb 20, 2014 at 2:56 PM
I think you are using an old version. That was added in Nov 2012 so you need to upgrade to a newer release.

October 2013 or
April 2013

Mike
Marked as answer by mikeFourie on 2/21/2014 at 2:55 AM
Feb 20, 2014 at 3:02 PM
OK, thanks Mike.