使用服务的实例存在于Microsoft.Sdc.Tasks MSBuild任务? [英] Example of using Service Exists MSBuild task in Microsoft.Sdc.Tasks?

查看:109
本文介绍了使用服务的实例存在于Microsoft.Sdc.Tasks MSBuild任务?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图使用 Microsoft.Sdc.Tasks.ServiceProcess.Exists 来检查服务是否存在。还有,虽然使用它的文档中没有例子。任何人有一个?

I'm trying to use the Microsoft.Sdc.Tasks.ServiceProcess.Exists to check whether or not a service exists. There is no example of using it in the documentation though. Anyone have one?

推荐答案

我还没有实际使用该生产我自己,我不知道您的版本(我有2.1.3155.0版本的副本),并根据所附的.chm帮助文件的任务具有以下属性:

I've not actually used this in production myself, and I'm not sure which version you have (I have a copy of Release 2.1.3155.0) and according to the accompanying .chm help file the Task has the following properties:

  • DoesExist返回true,如果指定的服务存在
  • IsDisabled如果该服务被禁用,则返回TRUE
  • 在服务名称标识服务系统的简称。

的服务名称需要被设置为标识的服务给系统,例如'W3SVC'短名称。

The ServiceName needs to be set to "The short name that identifies the service to the system, e.g. 'W3SVC'".

您可能想给它一个知名的服务一试(如MSSQLSERVER),并检查其它两个属性的结果(DoesExist / IsDisabled)。

You might want to give it a try with a well known service (e.g. mssqlserver) and check the result of the other two properties (DoesExist/IsDisabled).

更新:下面是一个示例(工程):

Update: Here's a sample (works):

导入任务,然后调用(例如)

Import the tasks, then call (e.g.)

< Microsoft.Sdc.Tasks.ServiceProcess.Exists        服务名称=服务器>       <输出TaskParameter =DoesExist属性名=存在/> < /Microsoft.Sdc.Tasks.ServiceProcess.Exists>

< Microsoft.Sdc.Tasks.ServiceProcess.Exists ServiceName="Server"> < Output TaskParameter="DoesExist" PropertyName="Exists" /> < /Microsoft.Sdc.Tasks.ServiceProcess.Exists >

&LT;消息文本=服务存在?$(存在)/>

< Message Text="Service exists? $(Exists)" />

这篇关于使用服务的实例存在于Microsoft.Sdc.Tasks MSBuild任务?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆