{"id":260594,"date":"2015-07-02T17:35:02","date_gmt":"2015-07-02T13:35:02","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=260594"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=260594","title":{"rendered":"\u041f\u0438\u0448\u0435\u043c Custom MSBuild Task \u0434\u043b\u044f \u0434\u0435\u043f\u043b\u043e\u044f (WMI included)"},"content":{"rendered":"<p>     \t\u0414\u043e\u0431\u0440\u044b\u0439 \u0434\u0435\u043d\u044c! \u041e\u0434\u043d\u0438\u043c \u043f\u0440\u0435\u043a\u0440\u0430\u0441\u043d\u044b\u043c \u0434\u043d\u0435\u043c \u043c\u044b \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0438\u043b\u0438, \u0447\u0442\u043e \u043d\u0430\u0448 MSBuild \u0434\u0435\u043f\u043b\u043e\u0439 \u043f\u0440\u043e\u0435\u043a\u0442 \u043d\u0435 \u0445\u043e\u0447\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0432 \u043d\u043e\u0432\u043e\u0439 \u0441\u0440\u0435\u0434\u0435: \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0438 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0441\u0430\u0439\u0442\u0430\u043c\u0438 \u0438 \u043f\u0443\u043b\u0430\u043c\u0438 \u043e\u043d \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b MSBuild.ExtensionPack. \u041f\u0430\u0434\u0430\u043b\u0438 \u043e\u0448\u0438\u0431\u043a\u0438, \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u044b\u0435 \u0441 \u043d\u0435\u0434\u043e\u0441\u0442\u0443\u043f\u043d\u043e\u0441\u0442\u044c\u044e DCOM. \u0421\u0440\u0435\u0434\u0443 \u043c\u0435\u043d\u044f\u0442\u044c \u0431\u044b\u043b\u043e \u043d\u0435\u043b\u044c\u0437\u044f, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043a\u0441\u0442\u0430\u0442\u0438 \u043f\u0440\u0438\u0448\u043b\u0430\u0441\u044c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0445 \u0437\u0430\u0434\u0430\u0447 \u0434\u043b\u044f MSBuild: <a href=\"https:\/\/msdn.microsoft.com\/en-us\/library\/t9883dzc.aspx\">msdn.microsoft.com\/en-us\/library\/t9883dzc.aspx<\/a>, \u0431\u044b\u043b\u043e \u043f\u0440\u0438\u043d\u044f\u0442\u043e \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0441\u0432\u043e\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u043b\u0438 \u0431\u044b \u0447\u0435\u0440\u0435\u0437 WMI (\u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b\u0439 \u043d\u0430 \u0441\u0440\u0435\u0434\u0435) \u041a\u043e\u043c\u0443 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e, \u0447\u0442\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u043e\u0441\u044c, \u043f\u0440\u043e\u0448\u0443 \u043f\u043e\u0434 \u043a\u0430\u0442.<br \/>  <a name=\"habracut\"><\/a>  <\/p>\n<h3>\u041f\u043e\u0447\u0435\u043c\u0443 MSBuild \u0438 WMI<\/h3>\n<p>  \u0415\u0441\u0442\u044c \u0442\u0430\u043a\u0438\u0435 \u0441\u0440\u0435\u0434\u044b, \u0432 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043c\u044b \u043d\u0435 \u0432\u043b\u0430\u0441\u0442\u043d\u044b \u043e\u0442\u043a\u0440\u044b\u0432\u0430\u0442\u044c \u043f\u043e\u0440\u0442\u044b \u0438 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0438\u0445 \u043a\u0430\u043a \u0445\u043e\u0442\u0438\u043c. \u041e\u0434\u043d\u0430\u043a\u043e \u0432 \u0434\u0430\u043d\u043d\u043e\u0439 \u0441\u0440\u0435\u0434\u0435 \u0443\u0436\u0435 \u0432\u0441\u0435 \u0431\u044b\u043b\u043e \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043d\u043e \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b WMI \u0432\u043d\u0443\u0442\u0440\u0438 \u0432\u0441\u0435\u0439 \u0441\u0435\u0442\u0438, \u0442\u0430\u043a \u0447\u0442\u043e \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c WMI \u0431\u044b\u043b\u043e \u043d\u0430\u0438\u0431\u043e\u043b\u0435\u0435 \u0431\u0435\u0437\u0431\u043e\u043b\u0435\u0437\u043d\u0435\u043d\u043d\u044b\u043c.<br \/>  MSBuild \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0441\u044f \u0434\u043b\u044f \u0434\u0435\u043f\u043b\u043e\u044f \u043d\u0435\u0441\u043b\u043e\u0436\u043d\u043e\u0433\u043e \u0441\u0430\u0439\u0442\u0430 \u0441 \u0441\u0430\u043c\u043e\u0433\u043e \u043d\u0430\u0447\u0430\u043b\u0430, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0431\u044b\u043b\u043e \u0432\u044b\u0431\u0440\u0430\u043d\u043e \u043d\u0435 \u043f\u0435\u0440\u0435\u043f\u0438\u0441\u044b\u0432\u0430\u0442\u044c \u0432\u0435\u0441\u044c \u0434\u0435\u043f\u043b\u043e\u0439\u043c\u0435\u043d\u0442 \u043d\u0430 Nant, \u0430 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0443\u0436\u0435 \u0438\u043c\u0435\u044e\u0449\u0438\u0439\u0441\u044f \u0441\u043a\u0440\u0438\u043f\u0442 \u0438 \u0437\u0430\u043c\u0435\u043d\u0438\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u043d\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0449\u0438\u0435 \u0442\u0430\u0441\u043a\u0438.<\/p>\n<h3>\u041a\u0430\u043a \u043f\u0438\u0441\u0430\u0442\u044c \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0435 \u0437\u0430\u0434\u0430\u0447\u0438 \u0434\u043b\u044f MSBuild<\/h3>\n<p>  \u041f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0435\u043c \u0432 \u0441\u0432\u043e\u0439 \u043f\u0440\u043e\u0435\u043a\u0442 \u0441\u0431\u043e\u0440\u043a\u0438 Microsoft.Build.Framework, Microsoft.Build.Tasks.v4.0 \u0438 Microsoft.Build.Utilities.v4.0. \u0422\u0435\u043f\u0435\u0440\u044c \u0435\u0441\u0442\u044c 2 \u0430\u043b\u044c\u0442\u0435\u0440\u043d\u0430\u0442\u0438\u0432\u044b:<br \/>  1 \u2014 \u043d\u0430\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u044c \u043e\u0442 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430 <a href=\"https:\/\/msdn.microsoft.com\/en-us\/library\/microsoft.build.framework.itask.aspx\">ITask<\/a> \u0438 \u043f\u043e\u0442\u043e\u043c \u0441\u0430\u043c\u0443 \u043f\u0435\u0440\u0435\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0442\u044c \u043a\u0443\u0447\u0443 \u043c\u0435\u0442\u043e\u0434\u043e\u0432 \u0438 \u0441\u0432\u043e\u0439\u0441\u0442\u0432.<br \/>  2 \u2014 \u043d\u0430\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u044c \u043e\u0442 \u0430\u0431\u0441\u0442\u0440\u0430\u043a\u0442\u043d\u043e\u0433\u043e \u043a\u043b\u0430\u0441\u0441\u0430 <a href=\"https:\/\/msdn.microsoft.com\/en-us\/library\/microsoft.build.utilities.task.aspx\">Task<\/a> \u0438 \u043f\u0435\u0440\u0435\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u043c\u0435\u0442\u043e\u0434 Execute.<br \/>  \u041a\u0430\u043a \u043d\u0435\u0441\u043b\u043e\u0436\u043d\u043e \u0434\u043e\u0433\u0430\u0434\u0430\u0442\u044c\u0441\u044f, \u0431\u044b\u043b \u0432\u044b\u0431\u0440\u0430\u043d \u0432\u0442\u043e\u0440\u043e\u0439 \u043c\u0435\u0442\u043e\u0434.<br \/>   HelloWorld \u0434\u043b\u044f \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0439 \u0437\u0430\u0434\u0430\u0447\u0438:  <\/p>\n<pre><code>using System; using Microsoft.Build.Framework; using Microsoft.Build.Utilities;  namespace MyTasks {     public class SimpleTask : Task     {         public override bool Execute()         {             Log.LogMessage(&quot;Hello Habrahabr&quot;);             return true;         }     } } <\/code><\/pre>\n<p>  \u041c\u0435\u0442\u043e\u0434 Execute \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 true, \u0435\u0441\u043b\u0438 \u0437\u0430\u0434\u0430\u0447\u0430 \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u043b\u0430\u0441\u044c \u0443\u0441\u043f\u0435\u0448\u043d\u043e, \u0438 false \u2014 \u0432 \u043f\u0440\u043e\u0442\u0438\u0432\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435. \u0418\u0437 \u043f\u043e\u043b\u0435\u0437\u043d\u044b\u0445 \u0441\u0432\u043e\u0439\u0441\u0442\u0432, \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b\u0445 \u0432 \u043a\u043b\u0430\u0441\u0441\u0435 Task \u0441\u0442\u043e\u0438\u0442 \u043e\u0442\u043c\u0435\u0442\u0438\u0442\u044c \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u043e <a href=\"https:\/\/msdn.microsoft.com\/en-us\/library\/microsoft.build.utilities.task.log.aspx\">Log<\/a>, \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0449\u0435\u0435 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0442\u044c \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u0441 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u043c.<br \/>  \u041f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u043f\u0435\u0440\u0435\u0434\u0430\u044e\u0442\u0441\u044f \u0442\u043e\u0436\u0435 \u043d\u0435\u0441\u043b\u043e\u0436\u043d\u043e, \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c \u043e\u0442\u043a\u0440\u044b\u0442\u043e\u0435 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u043e \u0432 \u044d\u0442\u043e\u043c \u043a\u043b\u0430\u0441\u0441\u0435 (\u0441 \u043e\u0442\u043a\u0440\u044b\u0442\u044b\u043c\u0438 \u0433\u0435\u0442\u0442\u0435\u0440\u043e\u043c \u0438 \u0441\u0435\u0442\u0442\u0435\u0440\u043e\u043c):  <\/p>\n<pre><code>using System; using Microsoft.Build.Framework; using Microsoft.Build.Utilities;  namespace MyTasks {     public class SimpleTask : Task     {         public string AppPoolName { get; set; }          [Output]         public bool Exists { get; set; }          public override bool Execute()         {             Log.LogMessage(&quot;Hello Habrahabr&quot;);             return true;         }     } } <\/code><\/pre>\n<p>  \u0427\u0442\u043e\u0431\u044b \u043d\u0430\u0448\u0430 \u0437\u0430\u0434\u0430\u0447\u0430 \u0447\u0442\u043e-\u0442\u043e \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u043b\u0430, \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0443 \u043d\u0430\u0434\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0430\u0442\u0440\u0438\u0431\u0443\u0442 [Output].<br \/>  \u0422\u0430\u043a \u0447\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0441\u043a\u0430\u0437\u0430\u0442\u044c, \u0447\u0442\u043e \u043f\u0440\u043e\u0441\u0442\u043e\u0442\u0430 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u0442\u0430\u043a\u0436\u0435 \u044f\u0432\u0438\u043b\u0430\u0441\u044c \u043f\u043b\u044e\u0441\u043e\u043c \u0434\u0430\u043d\u043d\u043e\u0433\u043e \u0440\u0435\u0448\u0435\u043d\u0438\u044f. \u041d\u0430 \u0442\u043e\u043c, \u043a\u0430\u043a \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e WMI \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c IIS \u044f \u043e\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0442\u044c\u0441\u044f <a href=\"http:\/\/www.iis.net\/learn\/manage\/scripting\/managing-sites-with-the-iis-wmi-provider\">\u043d\u0435 \u0431\u0443\u0434\u0443<\/a>, \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0442\u043c\u0435\u0447\u0443, \u0447\u0442\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c namespace WebAdministration, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0441\u0442\u0430\u0432\u0438\u0442\u0441\u044f \u0432\u043c\u0435\u0441\u0442\u0435 \u0441 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u043e\u043c Windows \u00abIIS Management Scripts and Tools\u00bb. <br \/>  \u041f\u043e\u0434 \u0441\u043f\u043e\u0439\u043b\u0435\u0440\u0430\u043c\u0438 \u043b\u0438\u0441\u0442\u0438\u043d\u0433 \u0431\u0430\u0437\u043e\u0432\u043e\u0439 \u0437\u0430\u0434\u0430\u0447\u0438, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0438\u043d\u043a\u0430\u043f\u0441\u0443\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u0430 \u043b\u043e\u0433\u0438\u043a\u0430 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u043a WMI \u0438 \u0431\u0430\u0437\u043e\u0432\u044b\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u0437\u0430\u0434\u0430\u0447\u0438, \u0442\u0430\u043a\u0438\u0435 \u043a\u0430\u043a:  <\/p>\n<ol>\n<li>Machine \u2014 \u0438\u043c\u044f \u0443\u0434\u0430\u043b\u0435\u043d\u043d\u043e\u0439 \u043c\u0430\u0448\u0438\u043d\u044b \u0438\u043b\u0438 localhost<\/li>\n<li>UserName \u2014 \u0438\u043c\u044f \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f, \u043f\u043e\u0434 \u043a\u043e\u0442\u043e\u0440\u044b\u043c \u0431\u0443\u0434\u0435\u043c \u043a\u043e\u043d\u043d\u0435\u043a\u0442\u0438\u0442\u044c\u0441\u044f \u043a WMI<\/li>\n<li>Password \u2014 \u043f\u0430\u0440\u043e\u043b\u044c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f, \u043f\u043e\u0434 \u043a\u043e\u0442\u043e\u0440\u044b\u043c \u0431\u0443\u0434\u0435\u043c \u043a\u043e\u043d\u043d\u0435\u043a\u0442\u0438\u0442\u044c\u0441\u044f \u043a WMI<\/li>\n<li>TaskAction \u2014 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u0441\u0430\u043c\u043e\u0433\u043e \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f (Create, Stop, Start, CheckExists)<\/li>\n<\/ol>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">BaseWMITask<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code>using Microsoft.Build.Utilities; using System; using System.Collections.Generic; using System.Linq; using System.Management; using System.Text; using System.Threading;  namespace MSBuild.WMI {     \/\/\/ &lt;summary&gt;     \/\/\/ This class will be used as a base class for all WMI MSBuild tasks.     \/\/\/ Contains logic for basic WMI operations as well as some basic properties (connection information, actual task action).     \/\/\/ &lt;\/summary&gt;     public abstract class BaseWMITask : Task     {         #region Private Fields          private ManagementScope _scope;          #endregion          #region Public Properties (Task Parameters)          \/\/\/ &lt;summary&gt;         \/\/\/ IP or host name of remote machine or &quot;localhost&quot;         \/\/\/ If not set - treated as &quot;localhost&quot;         \/\/\/ &lt;\/summary&gt;         public string Machine { get; set; }          \/\/\/ &lt;summary&gt;         \/\/\/ Username for connecting to remote machine         \/\/\/ &lt;\/summary&gt;         public string UserName { get; set; }          \/\/\/ &lt;summary&gt;         \/\/\/ Password for connecting to remote machine         \/\/\/ &lt;\/summary&gt;         public string Password { get; set; }          \/\/\/ &lt;summary&gt;         \/\/\/ Specific action to be executed (Start, Stop, etc.)         \/\/\/ &lt;\/summary&gt;         public string TaskAction { get; set; }          #endregion          #region Protected Members          \/\/\/ &lt;summary&gt;         \/\/\/ Gets WMI ManagementScope object         \/\/\/ &lt;\/summary&gt;         protected ManagementScope WMIScope         {             get             {                 if (_scope != null)                     return _scope;                  var wmiScopePath = string.Format(@&quot;\\\\{0}\\root\\WebAdministration&quot;, Machine);                  \/\/we should pass user as HOST\\\\USER                 var wmiUserName = UserName;                 if (wmiUserName != null && !wmiUserName.Contains(&quot;\\\\&quot;))                     wmiUserName = string.Concat(Machine, &quot;\\\\&quot;, UserName);                  var wmiConnectionOptions = new ConnectionOptions()                 {                     Username = wmiUserName,                     Password = Password,                     Impersonation = ImpersonationLevel.Impersonate,                     Authentication = AuthenticationLevel.PacketPrivacy,                     EnablePrivileges = true                 };                  \/\/use current user if this is a local machine                 if (Helpers.IsLocalHost(Machine))                 {                     wmiConnectionOptions.Username = null;                     wmiConnectionOptions.Password = null;                 }                  _scope = new ManagementScope(wmiScopePath, wmiConnectionOptions);                 _scope.Connect();                  return _scope;             }         }          \/\/\/ &lt;summary&gt;         \/\/\/ Gets task action         \/\/\/ &lt;\/summary&gt;         protected TaskAction Action         {             get             {                 return (WMI.TaskAction)Enum.Parse(typeof(WMI.TaskAction), TaskAction, true);             }         }          \/\/\/ &lt;summary&gt;         \/\/\/ Gets ManagementObject by query         \/\/\/ &lt;\/summary&gt;         \/\/\/ &lt;param name=&quot;queryString&quot;&gt;String WQL query&lt;\/param&gt;         \/\/\/ &lt;returns&gt;ManagementObject or null if it was not found&lt;\/returns&gt;         protected ManagementObject GetObjectByQuery(string queryString)         {             var query = new ObjectQuery(queryString);             using (var mos = new ManagementObjectSearcher(WMIScope, query))             {                 return mos.Get().Cast&lt;ManagementObject&gt;().FirstOrDefault();             }         }          \/\/\/ &lt;summary&gt;         \/\/\/ Wait till the condition returns True         \/\/\/ &lt;\/summary&gt;         \/\/\/ &lt;param name=&quot;condition&quot;&gt;Condition to be checked&lt;\/param&gt;         protected void WaitTill(Func&lt;bool&gt; condition)         {             while (!condition())             {                 Thread.Sleep(250);             }         }          #endregion     } } <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">AppPool<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code>using Microsoft.Build.Framework; using System; using System.Collections.Generic; using System.Linq; using System.Management; using System.Text; using System.Threading;  namespace MSBuild.WMI {     \/\/\/ &lt;summary&gt;     \/\/\/ This class is used for operations with IIS ApplicationPool.     \/\/\/ Possible actions:     \/\/\/   &quot;CheckExists&quot; - check if the pool with the name specified in &quot;AppPoolName&quot; exists, result is accessible through field &quot;Exists&quot;     \/\/\/   &quot;Create&quot; - create an application pool with the name specified in &quot;AppPoolName&quot;     \/\/\/   &quot;Start&quot; = starts Application Pool     \/\/\/   &quot;Stop&quot; - stops Application Pool     \/\/\/ &lt;\/summary&gt;     public class AppPool : BaseWMITask     {         #region Public Properties          \/\/\/ &lt;summary&gt;         \/\/\/ Application pool name         \/\/\/ &lt;\/summary&gt;         public string AppPoolName { get; set; }          \/\/\/ &lt;summary&gt;         \/\/\/ Used as outpur for CheckExists command - True, if application pool with the specified name exists         \/\/\/ &lt;\/summary&gt;         [Output]         public bool Exists { get; set; }          #endregion          #region Public Methods          \/\/\/ &lt;summary&gt;         \/\/\/ Executes the task         \/\/\/ &lt;\/summary&gt;         \/\/\/ &lt;returns&gt;True, is task has been executed successfully; False - otherwise&lt;\/returns&gt;         public override bool Execute()         {             try             {                 Log.LogMessage(&quot;AppPool task, action = {0}&quot;, Action);                 switch (Action)                 {                     case WMI.TaskAction.CheckExists:                         Exists = GetAppPool() != null;                         break;                      case WMI.TaskAction.Create:                         CreateAppPool();                         break;                      case WMI.TaskAction.Start:                         StartAppPool();                         break;                      case WMI.TaskAction.Stop:                         StopAppPool();                         break;                 }             }             catch (Exception ex)             {                 Log.LogErrorFromException(ex);                 return false;             }              \/\/WMI tasks are execute asynchronously, wait to completing             Thread.Sleep(1000);              return true;         }          #endregion          #region Private Methods          \/\/\/ &lt;summary&gt;         \/\/\/ Gets ApplicationPool with name AppPoolName         \/\/\/ &lt;\/summary&gt;         \/\/\/ &lt;returns&gt;ManagementObject representing ApplicationPool or null&lt;\/returns&gt;         private ManagementObject GetAppPool()         {             return GetObjectByQuery(string.Format(&quot;select * from ApplicationPool where Name = '{0}'&quot;, AppPoolName));         }          \/\/\/ &lt;summary&gt;         \/\/\/ Creates ApplicationPool with name AppPoolName, Integrated pipeline mode and ApplicationPoolIdentity (default)         \/\/\/ Calling code (MSBuild script) must first call CheckExists, in this method there's no checks         \/\/\/ &lt;\/summary&gt;         private void CreateAppPool()         {             var path = new ManagementPath(@&quot;ApplicationPool&quot;);             var mgmtClass = new ManagementClass(WMIScope, path, null);              \/\/obtain in-parameters for the method             var inParams = mgmtClass.GetMethodParameters(&quot;Create&quot;);              \/\/add the input parameters.             inParams[&quot;AutoStart&quot;] = true;             inParams[&quot;Name&quot;] = AppPoolName;              \/\/execute the method and obtain the return values.             mgmtClass.InvokeMethod(&quot;Create&quot;, inParams, null);              \/\/wait till pool is created             WaitTill(() =&gt; GetAppPool() != null);             var appPool = GetAppPool();              \/\/set pipeline mode (default is Classic)             appPool[&quot;ManagedPipelineMode&quot;] = (int)ManagedPipelineMode.Integrated;             appPool.Put();         }          \/\/\/ &lt;summary&gt;         \/\/\/ Starts Application Pool         \/\/\/ &lt;\/summary&gt;         private void StartAppPool()         {             GetAppPool().InvokeMethod(&quot;Start&quot;, null);         }          \/\/\/ &lt;summary&gt;         \/\/\/ Stops Application Pool         \/\/\/ &lt;\/summary&gt;         private void StopAppPool()         {             GetAppPool().InvokeMethod(&quot;Stop&quot;, null);         }          #endregion     } }  <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">WebSite<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code>using Microsoft.Build.Framework; using System; using System.Collections.Generic; using System.Linq; using System.Management; using System.Text; using System.Threading; using System.Threading.Tasks;  namespace MSBuild.WMI {     \/\/\/ &lt;summary&gt;     \/\/\/      \/\/\/ &lt;\/summary&gt;     public class WebSite : BaseWMITask     {         #region Public Properties          \/\/\/ &lt;summary&gt;         \/\/\/ Web Site name         \/\/\/ &lt;\/summary&gt;         public string SiteName { get; set; }          \/\/\/ &lt;summary&gt;         \/\/\/ Web Site physical path (not a UNC path)         \/\/\/ &lt;\/summary&gt;         public string PhysicalPath { get; set; }          \/\/\/ &lt;summary&gt;         \/\/\/ Port (it's better if it's custom)         \/\/\/ &lt;\/summary&gt;         public string Port { get; set; }          \/\/\/ &lt;summary&gt;         \/\/\/ Name of the Application Pool that will be used for this Web Site         \/\/\/ &lt;\/summary&gt;         public string AppPoolName { get; set; }          [Output]         public bool Exists { get; set; }          #endregion          #region Public Methods          \/\/\/ &lt;summary&gt;         \/\/\/ Executes the task         \/\/\/ &lt;\/summary&gt;         \/\/\/ &lt;returns&gt;True, is task has been executed successfully; False - otherwise&lt;\/returns&gt;         public override bool Execute()         {             try             {                 Log.LogMessage(&quot;WebSite task, action = {0}&quot;, Action);                 switch (Action)                 {                     case WMI.TaskAction.CheckExists:                         Exists = GetWebSite() != null;                         break;                      case WMI.TaskAction.Create:                         CreateWebSite();                         break;                      case WMI.TaskAction.Start:                         StartWebSite();                         break;                      case WMI.TaskAction.Stop:                         StopWebSite();                         break;                 }             }             catch (Exception ex)             {                 Log.LogErrorFromException(ex);                 return false;             }              \/\/WMI tasks are execute asynchronously, wait to completing             Thread.Sleep(1000);              return true;         }          #endregion          #region Private Methods          \/\/\/ &lt;summary&gt;         \/\/\/ Creates web site with the specified name and port. Bindings must be confgiured after manually.         \/\/\/ &lt;\/summary&gt;         private void CreateWebSite()         {             var path = new ManagementPath(@&quot;BindingElement&quot;);             var mgmtClass = new ManagementClass(WMIScope, path, null);              var binding = mgmtClass.CreateInstance();              binding[&quot;BindingInformation&quot;] = &quot;:&quot; + Port + &quot;:&quot;;             binding[&quot;Protocol&quot;] = &quot;http&quot;;              path = new ManagementPath(@&quot;Site&quot;);             mgmtClass = new ManagementClass(WMIScope, path, null);              \/\/ Obtain in-parameters for the method             var inParams = mgmtClass.GetMethodParameters(&quot;Create&quot;);              \/\/ Add the input parameters.             inParams[&quot;Bindings&quot;] = new ManagementBaseObject[] { binding };             inParams[&quot;Name&quot;] = SiteName;             inParams[&quot;PhysicalPath&quot;] = PhysicalPath;             inParams[&quot;ServerAutoStart&quot;] = true;              \/\/ Execute the method and obtain the return values.             mgmtClass.InvokeMethod(&quot;Create&quot;, inParams, null);              WaitTill(() =&gt; GetApp(&quot;\/&quot;) != null);             var rootApp = GetApp(&quot;\/&quot;);              rootApp[&quot;ApplicationPool&quot;] = AppPoolName;             rootApp.Put();         }          \/\/\/ &lt;summary&gt;         \/\/\/ Gets Web Site by name         \/\/\/ &lt;\/summary&gt;         \/\/\/ &lt;returns&gt;ManagementObject representing Web Site or null&lt;\/returns&gt;         private ManagementObject GetWebSite()         {             return GetObjectByQuery(string.Format(&quot;select * from Site where Name = '{0}'&quot;, SiteName));         }          \/\/\/ &lt;summary&gt;         \/\/\/ Get Virtual Application by path          \/\/\/ &lt;\/summary&gt;         \/\/\/ &lt;param name=&quot;path&quot;&gt;Path of virtual application (if path == &quot;\/&quot; - gets root application)&lt;\/param&gt;         \/\/\/ &lt;returns&gt;ManagementObject representing Virtual Application or null&lt;\/returns&gt;         private ManagementObject GetApp(string path)         {             return GetObjectByQuery(string.Format(&quot;select * from Application where SiteName = '{0}' and Path='{1}'&quot;, SiteName, path));         }          \/\/\/ &lt;summary&gt;         \/\/\/ Stop Web Site         \/\/\/ &lt;\/summary&gt;         private void StopWebSite()         {             GetWebSite().InvokeMethod(&quot;Stop&quot;, null);         }          \/\/\/ &lt;summary&gt;         \/\/\/ Start Web Site         \/\/\/ &lt;\/summary&gt;         private void StartWebSite()         {             GetWebSite().InvokeMethod(&quot;Start&quot;, null);         }          #endregion     } } <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  <\/p>\n<h3>\u0412\u044b\u0437\u044b\u0432\u0430\u0435\u043c \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0435 \u0437\u0430\u0434\u0430\u0447\u0438 \u0438\u0437 \u0431\u0438\u043b\u0434 \u0441\u043a\u0440\u0438\u043f\u0442\u0430<\/h3>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u043e\u0441\u0442\u0430\u043b\u043e\u0441\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u043d\u0430\u0443\u0447\u0438\u0442\u044c\u0441\u044f \u0432\u044b\u0437\u044b\u0432\u0430\u0442\u044c \u044d\u0442\u0438 \u0437\u0430\u0434\u0430\u0447\u0438 \u0438\u0437 \u0431\u0438\u043b\u0434 \u0441\u043a\u0440\u0438\u043f\u0442\u0430. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043d\u0430\u0434\u043e, \u0432\u043e-\u043f\u0435\u0440\u0432\u044b\u0445, \u0441\u043a\u0430\u0437\u0430\u0442\u044c MSBuild \u0433\u0434\u0435 \u043b\u0435\u0436\u0438\u0442 \u043d\u0430\u0448\u0430 \u0441\u0431\u043e\u0440\u043a\u0430 \u0438 \u043a\u0430\u043a\u0438\u0435 \u0437\u0430\u0434\u0430\u0447\u0438 \u043e\u0442\u0442\u0443\u0434\u0430 \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c:  <\/p>\n<pre><code class=\"xml\">&lt;UsingTask TaskName=&quot;MSBuild.WMI.AppPool&quot; AssemblyFile=&quot;MSBuild.WMI\\bin\\Debug\\MSBuild.WMI.dll&quot;\/&gt; <\/code><\/pre>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0437\u0430\u0434\u0430\u0447\u0443 MSBuild.WMI.AppPool \u0442\u043e\u0447\u043d\u043e \u0442\u0430\u043a \u0436\u0435, \u043a\u0430\u043a \u0438 \u0441\u0430\u043c\u044b\u0435 \u043e\u0431\u044b\u0447\u043d\u044b\u0435 MSBuild \u043a\u043e\u043c\u0430\u043d\u0434\u044b.  <\/p>\n<pre><code class=\"xml\">&lt;MSBuild.WMI.AppPool TaskAction=&quot;CheckExists&quot; AppPoolName=&quot;$(AppPoolName)&quot; Machine=&quot;$(Machine)&quot; UserName=&quot;$(User)&quot; Password=&quot;$(Password)&quot;&gt;       &lt;Output TaskParameter=&quot;Exists&quot; PropertyName=&quot;AppPoolExists&quot;\/&gt; &lt;\/MSBuild.WMI.AppPool&gt; <\/code><\/pre>\n<p>  \u041f\u043e\u0434 \u0441\u043f\u043e\u0439\u043b\u0435\u0440\u043e\u043c \u2014 \u043f\u0440\u0438\u043c\u0435\u0440 deploy.proj \u0444\u0430\u0439\u043b\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0443\u043c\u0435\u0435\u0442 \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u043f\u0443\u043b \u0438 \u0441\u0430\u0439\u0442 (\u0435\u0441\u043b\u0438 \u0438\u0445 \u043d\u0435\u0442), \u043e\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0442\u044c \u0438\u0445 \u043f\u0435\u0440\u0435\u0434 \u0434\u0435\u043f\u043b\u043e\u0435\u043c, \u0430 \u043f\u043e\u0442\u043e\u043c \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0442\u044c \u0437\u0430\u043d\u043e\u0432\u043e.   <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">deploy.proj<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"xml\">&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt; &lt;Project ToolsVersion=&quot;4.0&quot; DefaultTargets=&quot;Deploy&quot; xmlns=&quot;http:\/\/schemas.microsoft.com\/developer\/msbuild\/2003&quot;&gt;      &lt;!-- common variables --&gt;   &lt;PropertyGroup&gt;            &lt;Machine Condition=&quot;'$(AppPoolName)' == ''&quot;&gt;localhost&lt;\/Machine&gt;     &lt;User Condition=&quot;'$(User)' == ''&quot;&gt;&lt;\/User&gt;     &lt;Password Condition=&quot;'$(User)' == ''&quot;&gt;&lt;\/Password&gt;\t     &lt;AppPoolName Condition=&quot;'$(AppPoolName)' == ''&quot;&gt;TestAppPool&lt;\/AppPoolName&gt;     &lt;WebSiteName Condition=&quot;'$(WebSiteName)' == ''&quot;&gt;TestSite&lt;\/WebSiteName&gt;     &lt;WebSitePort Condition=&quot;'$(WebSitePort)' == ''&quot;&gt;8088&lt;\/WebSitePort&gt; \t&lt;WebSitePhysicalPath Condition=&quot;'$(WebSitePhysicalPath)' == ''&quot;&gt;D:\\Inetpub\\TestSite&lt;\/WebSitePhysicalPath&gt; \t&lt;AppPoolExists&gt;False&lt;\/AppPoolExists&gt;   &lt;\/PropertyGroup&gt;    &lt;UsingTask TaskName=&quot;MSBuild.WMI.AppPool&quot; AssemblyFile=&quot;MSBuild.WMI\\bin\\Debug\\MSBuild.WMI.dll&quot;\/&gt;   &lt;UsingTask TaskName=&quot;MSBuild.WMI.WebSite&quot; AssemblyFile=&quot;MSBuild.WMI\\bin\\Debug\\MSBuild.WMI.dll&quot;\/&gt;      &lt;!-- set up variables --&gt;   &lt;Target Name=&quot;_Setup&quot;&gt;     &lt;MSBuild.WMI.AppPool TaskAction=&quot;CheckExists&quot; AppPoolName=&quot;$(AppPoolName)&quot; Machine=&quot;$(Machine)&quot; UserName=&quot;$(User)&quot; Password=&quot;$(Password)&quot;&gt;       &lt;Output TaskParameter=&quot;Exists&quot; PropertyName=&quot;AppPoolExists&quot;\/&gt;     &lt;\/MSBuild.WMI.AppPool&gt; \t&lt;MSBuild.WMI.WebSite TaskAction=&quot;CheckExists&quot; SiteName=&quot;$(WebSiteName)&quot; Machine=&quot;$(Machine)&quot; UserName=&quot;$(User)&quot; Password=&quot;$(Password)&quot;&gt;       &lt;Output TaskParameter=&quot;Exists&quot; PropertyName=&quot;WebSiteExists&quot;\/&gt;     &lt;\/MSBuild.WMI.WebSite&gt;   &lt;\/Target&gt;      &lt;!-- stop web site --&gt;   &lt;Target Name=&quot;_StopSite&quot;&gt; \t&lt;MSBuild.WMI.WebSite TaskAction=&quot;Stop&quot; SiteName=&quot;$(WebSiteName)&quot; Machine=&quot;$(Machine)&quot; UserName=&quot;$(User)&quot; Password=&quot;$(Password)&quot; Condition=&quot;'$(WebSiteExists)'=='True'&quot; \/&gt;     &lt;MSBuild.WMI.AppPool TaskAction=&quot;Stop&quot; AppPoolName=&quot;$(AppPoolName)&quot; Machine=&quot;$(Machine)&quot; UserName=&quot;$(User)&quot; Password=&quot;$(Password)&quot; Condition=&quot;'$(AppPoolExists)'=='True'&quot; \/&gt;   &lt;\/Target&gt;    &lt;!-- stop and deploy web site --&gt;   &lt;Target Name=&quot;_StopAndDeployWebSite&quot;&gt;      &lt;!-- stop (if it exists) --&gt;     &lt;CallTarget Targets=&quot;_StopSite&quot; \/&gt;          &lt;!-- create AppPool (if does not exist) --&gt;     &lt;MSBuild.WMI.AppPool TaskAction=&quot;Create&quot; AppPoolName=&quot;$(AppPoolName)&quot; Machine=&quot;$(Machine)&quot; UserName=&quot;$(User)&quot; Password=&quot;$(Password)&quot; Condition=&quot;'$(AppPoolExists)'=='False'&quot; \/&gt; \t \t&lt;!-- create web site (if does not exist)--&gt; \t&lt;MSBuild.WMI.WebSite TaskAction=&quot;Create&quot; SiteName=&quot;$(WebSiteName)&quot; Port=&quot;$(WebSitePort)&quot; \t    AppPoolName=&quot;$(AppPoolName)&quot; Machine=&quot;$(Machine)&quot; UserName=&quot;$(User)&quot; Password=&quot;$(Password)&quot; PhysicalPath=&quot;$(WebSitePhysicalPath)&quot; \t\tCondition=&quot;'$(WebSiteExists)'=='False'&quot; \/&gt;   &lt;\/Target&gt;    &lt;!-- start all application parts --&gt;   &lt;Target Name=&quot;_StartAll&quot;&gt;     &lt;MSBuild.WMI.AppPool TaskAction=&quot;Start&quot; AppPoolName=&quot;$(AppPoolName)&quot; Machine=&quot;$(Machine)&quot; UserName=&quot;$(User)&quot; Password=&quot;$(Password)&quot; \/&gt; \t&lt;MSBuild.WMI.WebSite TaskAction=&quot;Start&quot; SiteName=&quot;$(WebSiteName)&quot; Machine=&quot;$(Machine)&quot; UserName=&quot;$(User)&quot; Password=&quot;$(Password)&quot; \/&gt;   &lt;\/Target&gt;    &lt;!-- deployment implementation --&gt;   &lt;Target Name=&quot;_DeployAll&quot;&gt;     &lt;CallTarget Targets=&quot;_StopAndDeployWebSite&quot; \/&gt;     &lt;CallTarget Targets=&quot;_StartAll&quot; \/&gt;   &lt;\/Target&gt;    &lt;!-- deploy application --&gt;   &lt;Target Name=&quot;Deploy&quot; DependsOnTargets=&quot;_Setup&quot;&gt;     &lt;CallTarget Targets=&quot;_DeployAll&quot; \/&gt;   &lt;\/Target&gt;    &lt;!-- stop application --&gt;   &lt;Target Name=&quot;StopApplication&quot; DependsOnTargets=&quot;_Setup&quot;&gt;     &lt;CallTarget Targets=&quot;_StopWebSite&quot; \/&gt;   &lt;\/Target&gt;        &lt;!-- start application --&gt;   &lt;Target Name=&quot;StartApplication&quot; DependsOnTargets=&quot;_Setup&quot;&gt;     &lt;CallTarget Targets=&quot;_StartAll&quot; \/&gt;   &lt;\/Target&gt;      &lt;\/Project&gt; <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  \u0414\u043b\u044f \u0432\u044b\u0437\u043e\u0432\u0430 \u0434\u0435\u043f\u043b\u043e\u044f \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043f\u0435\u0440\u0435\u0434\u0430\u0442\u044c \u044d\u0442\u043e\u0442 \u0444\u0430\u0439\u043b msbuild.exe:  <\/p>\n<pre><code class=\"bash\">&quot;C:\\Program Files (x86)\\MSBuild\\12.0\\Bin\\msbuild.exe&quot; deploy.proj <\/code><\/pre>\n<h3>\u0412\u044b\u0432\u043e\u0434\u044b \u0438 \u0441\u0441\u044b\u043b\u043a\u0438<\/h3>\n<p>  \u041c\u043e\u0436\u043d\u043e \u0441\u043a\u0430\u0437\u0430\u0442\u044c, \u0447\u0442\u043e \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0441\u0432\u043e\u0438 \u0437\u0430\u0434\u0430\u0447\u0438 \u0438 \u043f\u043e\u0434\u0441\u0443\u043d\u0443\u0442\u044c \u0438\u0445 MSBuild \u0441\u043e\u0432\u0441\u0435\u043c \u043d\u0435 \u0441\u043b\u043e\u0436\u043d\u043e. \u0421\u043f\u0435\u043a\u0442\u0440 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0439, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u043e\u0433\u0443\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c \u0442\u0430\u043a\u0438\u0435 \u0437\u0430\u0434\u0430\u0447\u0438, \u0442\u043e\u0436\u0435 \u0432\u0435\u0441\u044c\u043c\u0430 \u0448\u0438\u0440\u043e\u043a \u0438 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c MSBuild \u0434\u0430\u0436\u0435 \u0434\u043b\u044f \u043d\u0435 \u0441\u0430\u043c\u044b\u0445 \u0442\u0440\u0438\u0432\u0438\u0430\u043b\u044c\u043d\u044b\u0445 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0439 \u043f\u043e \u0434\u0435\u043f\u043b\u043e\u044e, \u043d\u0435 \u0442\u0440\u0435\u0431\u0443\u044f \u043d\u0438\u0447\u0435\u0433\u043e, \u043a\u0440\u043e\u043c\u0435 msbuild.exe. \u041d\u0430 \u0433\u0438\u0442\u0445\u0430\u0431\u0435 \u0432\u044b\u043b\u043e\u0436\u0435\u043d \u044d\u0442\u043e\u0442 \u043f\u0440\u043e\u0435\u043a\u0442 \u0441 \u043f\u0440\u0438\u043c\u0435\u0440\u043e\u043c \u0431\u0438\u043b\u0434 \u0444\u0430\u0439\u043b\u0430: <a href=\"https:\/\/github.com\/StanislavUshakov\/MSBuild.WMI\">github.com\/StanislavUshakov\/MSBuild.WMI<\/a> \u041c\u043e\u0436\u043d\u043e \u0440\u0430\u0441\u0448\u0438\u0440\u044f\u0442\u044c \u0438 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0442\u044c \u043d\u043e\u0432\u044b\u0435 \u0437\u0430\u0434\u0430\u0447\u0438!     \t<\/p>\n<div class=\"clear\"><\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"http:\/\/habrahabr.ru\/post\/261603\/\"> http:\/\/habrahabr.ru\/post\/261603\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>     \t\u0414\u043e\u0431\u0440\u044b\u0439 \u0434\u0435\u043d\u044c! \u041e\u0434\u043d\u0438\u043c \u043f\u0440\u0435\u043a\u0440\u0430\u0441\u043d\u044b\u043c \u0434\u043d\u0435\u043c \u043c\u044b \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0438\u043b\u0438, \u0447\u0442\u043e \u043d\u0430\u0448 MSBuild \u0434\u0435\u043f\u043b\u043e\u0439 \u043f\u0440\u043e\u0435\u043a\u0442 \u043d\u0435 \u0445\u043e\u0447\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0432 \u043d\u043e\u0432\u043e\u0439 \u0441\u0440\u0435\u0434\u0435: \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0438 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0441\u0430\u0439\u0442\u0430\u043c\u0438 \u0438 \u043f\u0443\u043b\u0430\u043c\u0438 \u043e\u043d \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b MSBuild.ExtensionPack. \u041f\u0430\u0434\u0430\u043b\u0438 \u043e\u0448\u0438\u0431\u043a\u0438, \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u044b\u0435 \u0441 \u043d\u0435\u0434\u043e\u0441\u0442\u0443\u043f\u043d\u043e\u0441\u0442\u044c\u044e DCOM. \u0421\u0440\u0435\u0434\u0443 \u043c\u0435\u043d\u044f\u0442\u044c \u0431\u044b\u043b\u043e \u043d\u0435\u043b\u044c\u0437\u044f, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043a\u0441\u0442\u0430\u0442\u0438 \u043f\u0440\u0438\u0448\u043b\u0430\u0441\u044c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0445 \u0437\u0430\u0434\u0430\u0447 \u0434\u043b\u044f MSBuild: <a href=\"https:\/\/msdn.microsoft.com\/en-us\/library\/t9883dzc.aspx\">msdn.microsoft.com\/en-us\/library\/t9883dzc.aspx<\/a>, \u0431\u044b\u043b\u043e \u043f\u0440\u0438\u043d\u044f\u0442\u043e \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0441\u0432\u043e\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u043b\u0438 \u0431\u044b \u0447\u0435\u0440\u0435\u0437 WMI (\u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b\u0439 \u043d\u0430 \u0441\u0440\u0435\u0434\u0435) \u041a\u043e\u043c\u0443 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e, \u0447\u0442\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u043e\u0441\u044c, \u043f\u0440\u043e\u0448\u0443 \u043f\u043e\u0434 \u043a\u0430\u0442.  <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-260594","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/260594","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=260594"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/260594\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=260594"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=260594"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=260594"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}