Process Class | MSBuild Extension Pack Help 4.0.12.0 |
Valid TaskActions are:
CheckRunning (Required: ProcessName Output: IsRunning)
Create (Required: Parameters Output: ReturnValue, ProcessId)
Get (Required: ProcessName, Value Optional: User, ProcessName, IncludeUserInfo Output: Processes)
Terminate (Required: ProcessName or ProcessId)
Remote Execution Support: Yes
Inheritance Hierarchy
MSBuild.ExtensionPackBaseTask
MSBuild.ExtensionPack.ComputerProcess
Namespace: MSBuild.ExtensionPack.Computer
Assembly: MSBuild.ExtensionPack (in MSBuild.ExtensionPack.dll) Version: 4.0.0.0
The Process type exposes the following members.
Constructors
Name | Description | |
---|---|---|
Process |
Properties
Name | Description | |
---|---|---|
IncludeUserInfo |
Sets whether to include user information for processes. Including this will slow the query. Default is false;
| |
IsRunning |
Gets whether the process is running
| |
Parameters |
Sets the Parameters for Create. Use #~# separate name and value.
| |
Processes |
Gets the list of processes. The process name is used as the identity and the following metadata is set: Caption, Description, Handle, HandleCount, KernelModeTime, PageFaults, PageFileUsage, ParentProcessId, PeakPageFileUsage, PeakVirtualSize, PeakWorkingSetSize, Priority, PrivatePageCount, ProcessId, QuotaNonPagedPoolUsage, QuotaPagedPoolUsage, QuotaPeakNonPagedPoolUsage, QuotaPeakPagedPoolUsage, ReadOperationCount, ReadTransferCount, SessionId, ThreadCount, UserModeTime, VirtualSize, WindowsVersion, WorkingSetSize, WriteOperationCount, WriteTransferCount
| |
ProcessId |
Gets or Sets the ProcessId
| |
ProcessName |
Sets the regular expression to use for filtering processes. Default is .*
| |
ReturnValue |
Gets the ReturnValue for Create
| |
User |
Sets the regular expression to use for filtering processes. Default is .*
|
Examples
<Project ToolsVersion="4.0" DefaultTargets="Default" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <PropertyGroup> <TPath>$(MSBuildProjectDirectory)\..\MSBuild.ExtensionPack.tasks</TPath> <TPath Condition="Exists('$(MSBuildProjectDirectory)\..\..\Common\MSBuild.ExtensionPack.tasks')">$(MSBuildProjectDirectory)\..\..\Common\MSBuild.ExtensionPack.tasks</TPath> </PropertyGroup> <Import Project="$(TPath)"/> <ItemGroup> <WmiExec3 Include="CommandLine#~#notepad.exe"/> </ItemGroup> <Target Name="Default"> <MSBuild.ExtensionPack.Computer.Process TaskAction="Terminate" ProcessId="9564"/> <MSBuild.ExtensionPack.Computer.Process TaskAction="Create" Parameters="@(WmiExec3)"> <Output TaskParameter="ReturnValue" PropertyName="Rval2"/> <Output TaskParameter="ProcessId" PropertyName="PID"/> </MSBuild.ExtensionPack.Computer.Process> <Message Text="ReturnValue: $(Rval2). ProcessId: $(PID)"/> <MSBuild.ExtensionPack.Computer.Process TaskAction="CheckRunning" ProcessName="notepad.exe"> <Output PropertyName="Running" TaskParameter="IsRunning"/> </MSBuild.ExtensionPack.Computer.Process> <Message Text="notepad.exe IsRunning: $(Running)"/> <MSBuild.ExtensionPack.Computer.Process TaskAction="Terminate" ProcessName="notepad.exe"/> <MSBuild.ExtensionPack.Computer.Process TaskAction="CheckRunning" ProcessName="notepad.exe"> <Output PropertyName="Running" TaskParameter="IsRunning"/> </MSBuild.ExtensionPack.Computer.Process> <Message Text="notepad.exe IsRunning: $(Running)"/> <MSBuild.ExtensionPack.Computer.Process TaskAction="Get" IncludeUserInfo="true"> <Output ItemName="ProcessList" TaskParameter="Processes"/> </MSBuild.ExtensionPack.Computer.Process> <Message Text="%(ProcessList.Identity) - %(ProcessList.User) - %(ProcessList.OwnerSID)"/> </Target> </Project>
See Also