<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:pingback="http://madskills.com/public/xml/rss/module/pingback/" version="2.0">
  <channel>
    <title>Sayed Ibrahim Hashimi</title>
    <link>http://www.sedodream.com/</link>
    <description>MSBuild, C#, Visual Studio, and more</description>
    <language>en-us</language>
    <copyright>Sayed Ibrahim Hashimi</copyright>
    <lastBuildDate>Fri, 27 Jun 2008 06:28:35 GMT</lastBuildDate>
    <generator>newtelligence dasBlog 1.8.5223.2</generator>
    <managingEditor>sayed.hashimi@gmail.com</managingEditor>
    <webMaster>sayed.hashimi@gmail.com</webMaster>
    <item>
      <trackback:ping>http://www.sedodream.com/Trackback.aspx?guid=a3e0f4b1-5714-4491-9134-cce95b1d6e19</trackback:ping>
      <pingback:server>http://www.sedodream.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.sedodream.com/PermaLink,guid,a3e0f4b1-5714-4491-9134-cce95b1d6e19.aspx</pingback:target>
      <dc:creator>sayed.hashimi@gmail.com (Sayed Ibrahim Hashimi)</dc:creator>
      <wfw:comment>http://www.sedodream.com/CommentView,guid,a3e0f4b1-5714-4491-9134-cce95b1d6e19.aspx</wfw:comment>
      <wfw:commentRss>http://www.sedodream.com/SyndicationService.asmx/GetEntryCommentsRss?guid=a3e0f4b1-5714-4491-9134-cce95b1d6e19</wfw:commentRss>
      <title>MSBuild Conditions on Targets</title>
      <guid>http://www.sedodream.com/PermaLink,guid,a3e0f4b1-5714-4491-9134-cce95b1d6e19.aspx</guid>
      <link>http://www.sedodream.com/PermaLink,guid,a3e0f4b1-5714-4491-9134-cce95b1d6e19.aspx</link>
      <pubDate>Fri, 27 Jun 2008 06:28:35 GMT</pubDate>
      <description>&lt;p class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;
   &lt;font face=Calibri color=#000000 size=3&gt;This post is related to my&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;previous
   post &lt;/font&gt;&lt;a href="http://www.sedodream.com/PermaLink,guid,096a2e3f-fcff-4715-8d00-73d8f2491a13.aspx"&gt;&lt;font face=Calibri size=3&gt;MSBuild
   RE: Enforcing the Build Agent in a Team Build&lt;/font&gt;&lt;/a&gt;&lt;font face=Calibri color=#000000 size=3&gt; which
   is a response on the post by Michael Ruminer at &lt;/font&gt;&lt;a href="http://manicprogrammer.com/cs/blogs/michaelruminer/archive/2008/06/19/enforcing-the-build-agent-in-a-team-build.aspx"&gt;&lt;font face=Calibri size=3&gt;http://manicprogrammer.com/cs/blogs/michaelruminer/archive/2008/06/19/enforcing-the-build-agent-in-a-team-build.aspx&lt;/font&gt;&lt;/a&gt;&lt;font face=Calibri color=#000000 size=3&gt;. &lt;/font&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;
   &lt;font face=Calibri color=#000000 size=3&gt;Basically every MSBuild element can contain
   a Condtions attribute. You can read more at &lt;/font&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/7szfhaft.aspx"&gt;&lt;font face=Calibri size=3&gt;MSBuild
   Conditions&lt;/font&gt;&lt;/a&gt;&lt;font face=Calibri color=#000000 size=3&gt;. So even targets can
   have conditions attached to them! Despite the fact that you can do this, you should
   not. I recommend that you do not use conditions on targets. Conditions on targets
   seem straight forward but after you take a closer look they are more complicated.
   We can take a look at some of the items that come to mind here.&lt;/font&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;
   &lt;b style="mso-bidi-font-weight: normal"&gt;&lt;font size=3&gt;&lt;font color=#000000&gt;&lt;font face=Calibri&gt;&lt;?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /&gt;Conditions
   on targets and DependsOnTargets don’t play well&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/b&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;
   &lt;font face=Calibri color=#000000 size=3&gt;Take a look at this simple project file&lt;/font&gt;
&lt;/p&gt;
&lt;p&gt;
   &lt;font face=Calibri size=3&gt;&lt;font color=#006400&gt;&amp;lt;?xml version="1.0" encoding="utf-8"?&amp;gt;&lt;br&gt;
   &amp;lt;Project ToolsVersion="2.0" 
   &lt;br&gt;
   &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; xmlns="&lt;/font&gt;&lt;a href="http://schemas.microsoft.com/developer/msbuild/2003"&gt;&lt;font color=#006400&gt;http://schemas.microsoft.com/developer/msbuild/2003&lt;/font&gt;&lt;/a&gt;&lt;font color=#006400&gt;"&lt;br&gt;
   &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; DefaultTargets="Demo"&amp;gt;&lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p&gt;
   &lt;font face=Calibri color=#006400 size=3&gt;&amp;nbsp; &amp;lt;PropertyGroup&amp;gt;&lt;br&gt;
   &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;AllowTarget&amp;gt;true&amp;lt;/AllowTarget&amp;gt;&lt;br&gt;
   &amp;nbsp; &amp;lt;/PropertyGroup&amp;gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p&gt;
   &lt;font face=Calibri color=#006400 size=3&gt;&amp;nbsp; &amp;lt;Target Name="SupressTarget"&amp;gt;&lt;br&gt;
   &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;CreateProperty Value="false"&amp;gt;&lt;br&gt;
   &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;Output PropertyName="AllowTarget" TaskParameter="Value"/&amp;gt;&lt;br&gt;
   &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/CreateProperty&amp;gt;&lt;br&gt;
   &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;Message Text=" ==== SupressTarget ==== " Importance="high"/&amp;gt;&lt;br&gt;
   &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;Message Text="AllowTarget: $(AllowTarget)"/&amp;gt;&lt;br&gt;
   &amp;nbsp; &amp;lt;/Target&amp;gt;&lt;br&gt;
   &amp;nbsp; 
   &lt;br&gt;
   &amp;nbsp; 
   &lt;br&gt;
   &amp;nbsp; &amp;lt;Target Name="Demo" Condition="'$(AllowTarget)'=='true'" 
   &lt;br&gt;
   &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; DependsOnTargets="SupressTarget"&amp;gt;&lt;br&gt;
   &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;Message Text=" ===== Demo ===== " Importance="high" /&amp;gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p&gt;
   &lt;font face=Calibri color=#006400 size=3&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;Message Text="AllowTarget:
   $(AllowTarget)"/&amp;gt;&lt;br&gt;
   &amp;nbsp; &amp;lt;/Target&amp;gt;&lt;br&gt;
   &amp;nbsp; 
   &lt;br&gt;
   &amp;lt;/Project&amp;gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p&gt;
   &lt;font face=Calibri color=#000000 size=3&gt;&lt;span style="FONT-SIZE: 12pt; FONT-FAMILY: 'Times New Roman','serif'; mso-fareast-font-family: 'Times New Roman'"&gt;In
   this project the main target is Demo and it depends on a target SupressTarget which
   actually disables the Demo target based on its condition. If you execute the command &lt;/span&gt;&lt;b style="mso-bidi-font-weight: normal"&gt;&lt;span style="FONT-SIZE: 12pt; FONT-FAMILY: 'Courier New'; mso-fareast-font-family: 'Times New Roman'"&gt;msbuild
   /t:Demo&lt;/span&gt;&lt;/b&gt;&lt;span style="FONT-SIZE: 12pt; FONT-FAMILY: 'Times New Roman','serif'; mso-fareast-font-family: 'Times New Roman'"&gt; you
   get the results shown below.&lt;/span&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p&gt;
   &lt;font face=Calibri color=#000000 size=3&gt;&lt;span style="FONT-SIZE: 12pt; FONT-FAMILY: 'Times New Roman','serif'; mso-fareast-font-family: 'Times New Roman'"&gt;
   &lt;o:p&gt;
      &lt;img alt="" hspace=0 src="http://www.sedodream.com/content/binary/20080627-01.png" align=baseline border=0&gt;
   &lt;/o:p&gt;
   &lt;/span&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;font face=Calibri color=#000000&gt;&lt;span style="FONT-SIZE: 12pt; FONT-FAMILY: 'Times New Roman','serif'; mso-fareast-font-family: 'Times New Roman'"&gt;
&lt;o:p&gt;
   &lt;p class=MsoNormal style="MARGIN: 0in 0in 10pt; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto"&gt;
      &lt;span style="FONT-SIZE: 12pt; FONT-FAMILY: 'Times New Roman','serif'; mso-fareast-font-family: 'Times New Roman'"&gt;Most
      users would expect that the target SupressTarget target would execute which sets the
      AllowTarget value to false, and then the Demo target is skipped. But what is happening
      here is that by the time DependsOnTargets is evaluated the condition has already been
      evaluated and has passed! The even more interesting thing here is if you execute&lt;/span&gt;&lt;b style="mso-bidi-font-weight: normal"&gt;&lt;span style="FONT-SIZE: 12pt; FONT-FAMILY: 'Courier New'; mso-fareast-font-family: 'Times New Roman'"&gt; msbuild
      /t:SupressTarget;Demo&lt;/span&gt;&lt;/b&gt;&lt;span style="FONT-SIZE: 12pt; FONT-FAMILY: 'Times New Roman','serif'; mso-fareast-font-family: 'Times New Roman'"&gt; the
      results are shown below.&lt;/span&gt;
   &lt;/p&gt;
   &lt;p class=MsoNormal style="MARGIN: 0in 0in 10pt; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto"&gt;
      &lt;span style="FONT-SIZE: 12pt; FONT-FAMILY: 'Times New Roman','serif'; mso-fareast-font-family: 'Times New Roman'"&gt;
      &lt;o:p&gt;&lt;/o:p&gt;
      &lt;/span&gt;&amp;nbsp;&lt;img alt="" hspace=0 src="http://www.sedodream.com/content/binary/20080627-02.png" align=baseline border=0&gt;
   &lt;/p&gt;
   &lt;p class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;
      &lt;font face=Calibri&gt;So this time it was skipped, because SupressTarget was called before
      the Demo target was invoked so the condition evaluated to false.&lt;/font&gt;
   &lt;/p&gt;
   &lt;p class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;
      &lt;o:p&gt;
         &lt;font face=Calibri&gt;&amp;nbsp;&lt;/font&gt;
      &lt;/o:p&gt;
   &lt;/p&gt;
   &lt;p class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;
      &lt;b style="mso-bidi-font-weight: normal"&gt;&lt;font face=Calibri&gt;Conditions and target batching
      doesn’t work well either&lt;o:p&gt;&lt;/o:p&gt;
      &lt;/font&gt;&lt;/b&gt;
   &lt;/p&gt;
   &lt;p class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;
      &lt;font face=Calibri&gt;If you are batching a target and you want to execute the target
      for some batches but not others, this cannot be achieved with target conditions, for
      a few reasons but the simplest is: Either a target is or is not defined. When the
      target is going to be executed for the first time the condition is evaluated. If the
      condition is true it will exist, otherwise it will not.&lt;/font&gt;
   &lt;/p&gt;
   &lt;p class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;
      &lt;font face=Calibri&gt;I thought of some other issues but they are not coming to me at
      this time, but I think this is enough to deter you from using target dependencies.
      Instead of target dependencies you should take a look at other way of achieving the
      same results.&lt;/font&gt;
   &lt;/p&gt;
   &lt;p class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;
      &lt;o:p&gt;
         &lt;font face=Calibri&gt;&amp;nbsp;&lt;/font&gt;
      &lt;/o:p&gt;
   &lt;/p&gt;
   &lt;p class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;
      &lt;font face=Calibri&gt;Sayed Ibrahim Hashimi&lt;/font&gt;
&lt;/o:p&gt;
&lt;/span&gt;&lt;/font&gt;&gt;
&lt;img width="0" height="0" src="http://www.sedodream.com/aggbug.ashx?id=a3e0f4b1-5714-4491-9134-cce95b1d6e19" /&gt;</description>
      <comments>http://www.sedodream.com/CommentView,guid,a3e0f4b1-5714-4491-9134-cce95b1d6e19.aspx</comments>
      <category>MSBuild;Team Build;TFS</category>
    </item>
    <item>
      <trackback:ping>http://www.sedodream.com/Trackback.aspx?guid=096a2e3f-fcff-4715-8d00-73d8f2491a13</trackback:ping>
      <pingback:server>http://www.sedodream.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.sedodream.com/PermaLink,guid,096a2e3f-fcff-4715-8d00-73d8f2491a13.aspx</pingback:target>
      <dc:creator>sayed.hashimi@gmail.com (Sayed Ibrahim Hashimi)</dc:creator>
      <wfw:comment>http://www.sedodream.com/CommentView,guid,096a2e3f-fcff-4715-8d00-73d8f2491a13.aspx</wfw:comment>
      <wfw:commentRss>http://www.sedodream.com/SyndicationService.asmx/GetEntryCommentsRss?guid=096a2e3f-fcff-4715-8d00-73d8f2491a13</wfw:commentRss>
      <slash:comments>1</slash:comments>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
      This is a post that responds to a post by Michael Ruminer at <a href="http://manicprogrammer.com/cs/blogs/michaelruminer/archive/2008/06/19/enforcing-the-build-agent-in-a-team-build.aspx">Enforcing
      the Build Agent in a Team Build</a>. I hope I correctly understand his situation.
      Here is my summary of it. 
   </p>
        <ul>
          <li>
         You have a specified value for the property <span style="color:#00b050; font-family:Courier New">BuildAgentName</span></li>
          <li>
         You create various MSBuild scripts that will hook into a TeamBuild 
      </li>
          <li>
         You want to specify in each MSBuild script the names of the build agents that are
         allowed to run the build 
      </li>
          <li>
         If the current value for <span style="color:#00b050; font-family:Courier New">BuildAgentName</span> is
         not in the list above, fail the build otherwise allow it to continue 
      </li>
        </ul>
        <p>
      My solution to this problem is to create a property, <span style="color:#00b050; font-family:Courier New">AllowedBuildAgents</span>,
      which will contain a semi-colon separated list of the allowed build agent names. Then
      this is converted into an item, <span style="color:#00b050; font-family:Courier New">AllowedBuildAgentsItem</span>,
      so batching can be preformed over it. If you are not familiar with MSBuild batching
      you can see my previous postings at: 
   </p>
        <ul>
          <li>
            <a href="http://www.sedodream.com/PermaLink,guid,5f1e0445-ce3d-4052-ba80-42fd19512d42.aspx">MSBuild
         Batching Part 1</a>
          </li>
          <li>
            <a href="http://www.sedodream.com/PermaLink,guid,b721bc22-c375-4e1e-bcc9-512dd64096bb.aspx">MSBuild
         Batching Part 2</a>
          </li>
          <li>
            <a href="http://www.sedodream.com/PermaLink,guid,cab57d7f-9d6e-4358-8491-dc033fb3bacc.aspx">MSBuild
         Batching Part 3</a>
          </li>
        </ul>
        <p>
      The main objective here is to create an item that contains all the allowed names, <span style="color:#00b050; font-family:Courier New">AllowedBuildAgentsItem</span>,
      and batch over them. If the value for <span style="color:#00b050; font-family:Courier New">BuildAgentName</span> is
      equal to any value in that item then we want to allow the build. I create a property <span style="color:#00b050; font-family:Courier New">BuildAgentAllowed</span> which
      defaults to false, and if that condition is true then I set <span style="color:#00b050; font-family:Courier New">BuildAgentAllowed</span> to
      true. So I created a target <span style="color:#00b050; font-family:Courier New">DetermineIfAuthorizedBuildAgent</span> that
      depends will throw an error if <span style="color:#00b050; font-family:Courier New">BuildAgentAllowed</span> is
      false. Also this target depends on the target that will actually populate that value,
      which is the <span style="color:#00b050; font-family:Courier New">GetBuildAgentAllowed</span> target.
      The build script is placed below. I added a few elements that were for demo only.
      Those are; value for BuildAgentName and BeforeEndToEndIteration target. See comments
      in the file (which can be downloaded at the end of this post). 
   </p>
        <p style="background: #d9d9d9">
      &lt;?xml version="1.0" encoding="utf-8"?&gt;<br />
      &lt;Project ToolsVersion="2.0" 
      <br />
      xmlns="http://schemas.microsoft.com/developer/msbuild/2003"<br />
      DefaultTargets="BeforeEndToEndIteration"&gt;<br /><br />
      &lt;!-- 
      <br />
      Assume that this value has been set already. 
      <br />
      I'm declaring it here for this demonstration.<br />
      --&gt;<br />
      &lt;PropertyGroup&gt;<br />
      &lt;BuildAgentName&gt;Sayed_001&lt;/BuildAgentName&gt;<br />
      &lt;/PropertyGroup&gt;<br /><br /><br /><br />
      &lt;PropertyGroup&gt;<br />
      &lt;BeforeEndToEndIterationDependsOn&gt;<br />
      $(BeforeEndToEndIterationDependsOn);<br />
      DetermineIfAuthorizedBuildAgent;<br />
      &lt;/BeforeEndToEndIterationDependsOn&gt;<br />
      &lt;/PropertyGroup&gt;<br /><br />
      &lt;!--<br />
      Define this here as a property so it can be passed 
      <br />
      via Properties from various callers.<br />
      --&gt;<br />
      &lt;PropertyGroup&gt;<br />
      &lt;AllowedBuildAgents&gt;Sayed_001;Sayed_003;Sayed_005&lt;/AllowedBuildAgents&gt;<br />
      &lt;/PropertyGroup&gt;<br /><br />
      &lt;!-- 
      <br />
      Convert the property into an item so we can batch over it.<br />
      --&gt;<br />
      &lt;ItemGroup&gt;<br />
      &lt;AllowedBuildAgentsItem Include="$(AllowedBuildAgents)"/&gt;<br />
      &lt;/ItemGroup&gt;<br />
      &lt;!-- 
      <br />
      Specify this value to false. If allowed it will be set to true.<br />
      --&gt;<br />
      &lt;PropertyGroup&gt;<br />
      &lt;BuildAgentAllowed&gt;false&lt;/BuildAgentAllowed&gt;<br />
      &lt;/PropertyGroup&gt;<br /><br /><br /><br />
      &lt;Target Name="PrintInfo"&gt;<br />
      &lt;Message Text="AllowedBuildAgentsItem: @(AllowedBuildAgentsItem,'%0a%0d')"/&gt;<br />
      &lt;/Target&gt;<br /><br />
      &lt;!-- Executing this target will make the GetBuildAgentAllowed target execute first
      --&gt;<br />
      &lt;Target Name="DetermineIfAuthorizedBuildAgent" 
      <br />
      DependsOnTargets="GetBuildAgentAllowed"&gt;<br />
      &lt;Message Text="BuildAgentAllowed: $(BuildAgentAllowed)"/&gt;<br />
      &lt;Error Text="This build can only be run on one of the following build agents: @(AllowedBuildAgentsItem)" 
      <br />
      Condition="'$(BuildAgentAllowed)'=='false'" /&gt;<br />
      &lt;/Target&gt;<br /><br />
      &lt;!-- 
      <br />
      This target will be executed for each value in the AllowedBuildAgentsItem.<br />
      If the BuildAgentName is equal to any value in AllowedBuildAgentsItem then the<br />
      property BuildAgentAllowed will be set to true.<br />
      --&gt;<br />
      &lt;Target Name="GetBuildAgentAllowed" Outputs="%(AllowedBuildAgentsItem.Identity)"&gt;<br />
      &lt;Message Text="GetBuildAgentAllowed %25(AllowedBuildAgentsItem.Identity): %(AllowedBuildAgentsItem.Identity)"/&gt;<br /><br />
      &lt;CreateProperty Value="true" Condition="'$(BuildAgentName)'=='%(AllowedBuildAgentsItem.Identity)'"&gt;<br />
      &lt;Output PropertyName="BuildAgentAllowed" TaskParameter="Value"/&gt;<br />
      &lt;/CreateProperty&gt;<br /><br />
      &lt;/Target&gt;<br /><br /><br /><br />
      &lt;!-- 
      <br />
      This target is really executed by TeamBuild but I will 
      <br />
      put it here for demonstration. If this target executes then the build<br />
      was allowed otherwise an error will be shown.<br />
      --&gt;<br />
      &lt;Target Name="BeforeEndToEndIteration" DependsOnTargets="$(BeforeEndToEndIterationDependsOn)"&gt;<br />
      &lt;Message Text="EndToEndIteration starting"/&gt;<br />
      &lt;/Target&gt;<br /><br />
      &lt;/Project&gt; 
   </p>
        <p>
      The only reason that I have defined the allowed build agents in a property (<span style="color:#00b050; font-family:Courier New">AllowedBuildAgents</span>)
      is because I want to allow external sources to specify it. You can specify properties
      through the <a href="http://msdn.microsoft.com/en-us/library/ms164311.aspx">command
      line</a> or when using the <a href="http://msdn.microsoft.com/en-us/library/7z253716.aspx">MSBuild
      Task</a>. Then the script converts this to an item. If I execute this project I would
      expect it to succeed because the defined value for BuildAgentName is contained in
      the list of <span style="color:#00b050; font-family:Courier New">AllowedBuildAgents</span>.
      The results of executing this project are shown below. 
   </p>
        <p>
          <img src="http://www.sedodream.com/content/binary/062008_0423_MSBuildREEn1.png" alt="" />
        </p>
        <p>
      Now we can change the value for <span style="color:#00b050; font-family:Courier New">BuildAgentName</span>,
      by using the command <span style="color:#00b050; font-family:Courier New">msbuild.exe
      BuildAgent01.proj /p:BuildAgentName=Sayed_010</span>. We would expect the build to
      fail. The results of this are below. 
   </p>
        <p>
          <img src="http://www.sedodream.com/content/binary/062008_0423_MSBuildREEn2.png" alt="" />
        </p>
        <p>
        </p>
        <p>
      So the build failed as expected so we are good. Any questions? 
   </p>
        <p>
        </p>
        <p>
          <a href="http://www.sedodream.com/content/binary/BuildAgent01.proj.txt">BuildAgent01.proj</a>
        </p>
        <p>
      Sayed Ibrahim Hashimi
   </p>
        <img width="0" height="0" src="http://www.sedodream.com/aggbug.ashx?id=096a2e3f-fcff-4715-8d00-73d8f2491a13" />
      </body>
      <title>MSBuild RE: Enforcing the Build Agent in a Team Build</title>
      <guid>http://www.sedodream.com/PermaLink,guid,096a2e3f-fcff-4715-8d00-73d8f2491a13.aspx</guid>
      <link>http://www.sedodream.com/PermaLink,guid,096a2e3f-fcff-4715-8d00-73d8f2491a13.aspx</link>
      <pubDate>Fri, 20 Jun 2008 04:22:57 GMT</pubDate>
      <description>&lt;p&gt;
   This is a post that responds to a post by Michael Ruminer at &lt;a href="http://manicprogrammer.com/cs/blogs/michaelruminer/archive/2008/06/19/enforcing-the-build-agent-in-a-team-build.aspx"&gt;Enforcing
   the Build Agent in a Team Build&lt;/a&gt;. I hope I correctly understand his situation.
   Here is my summary of it. 
&lt;/p&gt;
&lt;ul&gt;
   &lt;li&gt;
      You have a specified value for the property &lt;span style="color:#00b050; font-family:Courier New"&gt;BuildAgentName&lt;/span&gt; 
   &lt;/li&gt;
   &lt;li&gt;
      You create various MSBuild scripts that will hook into a TeamBuild 
   &lt;/li&gt;
   &lt;li&gt;
      You want to specify in each MSBuild script the names of the build agents that are
      allowed to run the build 
   &lt;/li&gt;
   &lt;li&gt;
      If the current value for &lt;span style="color:#00b050; font-family:Courier New"&gt;BuildAgentName&lt;/span&gt; is
      not in the list above, fail the build otherwise allow it to continue 
   &lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
   My solution to this problem is to create a property, &lt;span style="color:#00b050; font-family:Courier New"&gt;AllowedBuildAgents&lt;/span&gt;,
   which will contain a semi-colon separated list of the allowed build agent names. Then
   this is converted into an item, &lt;span style="color:#00b050; font-family:Courier New"&gt;AllowedBuildAgentsItem&lt;/span&gt;,
   so batching can be preformed over it. If you are not familiar with MSBuild batching
   you can see my previous postings at: 
&lt;/p&gt;
&lt;ul&gt;
   &lt;li&gt;
      &lt;a href="http://www.sedodream.com/PermaLink,guid,5f1e0445-ce3d-4052-ba80-42fd19512d42.aspx"&gt;MSBuild
      Batching Part 1&lt;/a&gt; 
   &lt;/li&gt;
   &lt;li&gt;
      &lt;a href="http://www.sedodream.com/PermaLink,guid,b721bc22-c375-4e1e-bcc9-512dd64096bb.aspx"&gt;MSBuild
      Batching Part 2&lt;/a&gt; 
   &lt;/li&gt;
   &lt;li&gt;
      &lt;a href="http://www.sedodream.com/PermaLink,guid,cab57d7f-9d6e-4358-8491-dc033fb3bacc.aspx"&gt;MSBuild
      Batching Part 3&lt;/a&gt; 
   &lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
   The main objective here is to create an item that contains all the allowed names, &lt;span style="color:#00b050; font-family:Courier New"&gt;AllowedBuildAgentsItem&lt;/span&gt;,
   and batch over them. If the value for &lt;span style="color:#00b050; font-family:Courier New"&gt;BuildAgentName&lt;/span&gt; is
   equal to any value in that item then we want to allow the build. I create a property &lt;span style="color:#00b050; font-family:Courier New"&gt;BuildAgentAllowed&lt;/span&gt; which
   defaults to false, and if that condition is true then I set &lt;span style="color:#00b050; font-family:Courier New"&gt;BuildAgentAllowed&lt;/span&gt; to
   true. So I created a target &lt;span style="color:#00b050; font-family:Courier New"&gt;DetermineIfAuthorizedBuildAgent&lt;/span&gt; that
   depends will throw an error if &lt;span style="color:#00b050; font-family:Courier New"&gt;BuildAgentAllowed&lt;/span&gt; is
   false. Also this target depends on the target that will actually populate that value,
   which is the &lt;span style="color:#00b050; font-family:Courier New"&gt;GetBuildAgentAllowed&lt;/span&gt; target.
   The build script is placed below. I added a few elements that were for demo only.
   Those are; value for BuildAgentName and BeforeEndToEndIteration target. See comments
   in the file (which can be downloaded at the end of this post). 
&lt;/p&gt;
&lt;p style="background: #d9d9d9"&gt;
   &amp;lt;?xml version="1.0" encoding="utf-8"?&amp;gt;&lt;br /&gt;
   &amp;lt;Project ToolsVersion="2.0" 
   &lt;br /&gt;
   xmlns="http://schemas.microsoft.com/developer/msbuild/2003"&lt;br /&gt;
   DefaultTargets="BeforeEndToEndIteration"&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
   &amp;lt;!-- 
   &lt;br /&gt;
   Assume that this value has been set already. 
   &lt;br /&gt;
   I'm declaring it here for this demonstration.&lt;br /&gt;
   --&amp;gt;&lt;br /&gt;
   &amp;lt;PropertyGroup&amp;gt;&lt;br /&gt;
   &amp;lt;BuildAgentName&amp;gt;Sayed_001&amp;lt;/BuildAgentName&amp;gt;&lt;br /&gt;
   &amp;lt;/PropertyGroup&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
   &lt;br /&gt;
   &lt;br /&gt;
   &amp;lt;PropertyGroup&amp;gt;&lt;br /&gt;
   &amp;lt;BeforeEndToEndIterationDependsOn&amp;gt;&lt;br /&gt;
   $(BeforeEndToEndIterationDependsOn);&lt;br /&gt;
   DetermineIfAuthorizedBuildAgent;&lt;br /&gt;
   &amp;lt;/BeforeEndToEndIterationDependsOn&amp;gt;&lt;br /&gt;
   &amp;lt;/PropertyGroup&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
   &amp;lt;!--&lt;br /&gt;
   Define this here as a property so it can be passed 
   &lt;br /&gt;
   via Properties from various callers.&lt;br /&gt;
   --&amp;gt;&lt;br /&gt;
   &amp;lt;PropertyGroup&amp;gt;&lt;br /&gt;
   &amp;lt;AllowedBuildAgents&amp;gt;Sayed_001;Sayed_003;Sayed_005&amp;lt;/AllowedBuildAgents&amp;gt;&lt;br /&gt;
   &amp;lt;/PropertyGroup&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
   &amp;lt;!-- 
   &lt;br /&gt;
   Convert the property into an item so we can batch over it.&lt;br /&gt;
   --&amp;gt;&lt;br /&gt;
   &amp;lt;ItemGroup&amp;gt;&lt;br /&gt;
   &amp;lt;AllowedBuildAgentsItem Include="$(AllowedBuildAgents)"/&amp;gt;&lt;br /&gt;
   &amp;lt;/ItemGroup&amp;gt;&lt;br /&gt;
   &amp;lt;!-- 
   &lt;br /&gt;
   Specify this value to false. If allowed it will be set to true.&lt;br /&gt;
   --&amp;gt;&lt;br /&gt;
   &amp;lt;PropertyGroup&amp;gt;&lt;br /&gt;
   &amp;lt;BuildAgentAllowed&amp;gt;false&amp;lt;/BuildAgentAllowed&amp;gt;&lt;br /&gt;
   &amp;lt;/PropertyGroup&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
   &lt;br /&gt;
   &lt;br /&gt;
   &amp;lt;Target Name="PrintInfo"&amp;gt;&lt;br /&gt;
   &amp;lt;Message Text="AllowedBuildAgentsItem: @(AllowedBuildAgentsItem,'%0a%0d')"/&amp;gt;&lt;br /&gt;
   &amp;lt;/Target&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
   &amp;lt;!-- Executing this target will make the GetBuildAgentAllowed target execute first
   --&amp;gt;&lt;br /&gt;
   &amp;lt;Target Name="DetermineIfAuthorizedBuildAgent" 
   &lt;br /&gt;
   DependsOnTargets="GetBuildAgentAllowed"&amp;gt;&lt;br /&gt;
   &amp;lt;Message Text="BuildAgentAllowed: $(BuildAgentAllowed)"/&amp;gt;&lt;br /&gt;
   &amp;lt;Error Text="This build can only be run on one of the following build agents: @(AllowedBuildAgentsItem)" 
   &lt;br /&gt;
   Condition="'$(BuildAgentAllowed)'=='false'" /&amp;gt;&lt;br /&gt;
   &amp;lt;/Target&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
   &amp;lt;!-- 
   &lt;br /&gt;
   This target will be executed for each value in the AllowedBuildAgentsItem.&lt;br /&gt;
   If the BuildAgentName is equal to any value in AllowedBuildAgentsItem then the&lt;br /&gt;
   property BuildAgentAllowed will be set to true.&lt;br /&gt;
   --&amp;gt;&lt;br /&gt;
   &amp;lt;Target Name="GetBuildAgentAllowed" Outputs="%(AllowedBuildAgentsItem.Identity)"&amp;gt;&lt;br /&gt;
   &amp;lt;Message Text="GetBuildAgentAllowed %25(AllowedBuildAgentsItem.Identity): %(AllowedBuildAgentsItem.Identity)"/&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
   &amp;lt;CreateProperty Value="true" Condition="'$(BuildAgentName)'=='%(AllowedBuildAgentsItem.Identity)'"&amp;gt;&lt;br /&gt;
   &amp;lt;Output PropertyName="BuildAgentAllowed" TaskParameter="Value"/&amp;gt;&lt;br /&gt;
   &amp;lt;/CreateProperty&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
   &amp;lt;/Target&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
   &lt;br /&gt;
   &lt;br /&gt;
   &amp;lt;!-- 
   &lt;br /&gt;
   This target is really executed by TeamBuild but I will 
   &lt;br /&gt;
   put it here for demonstration. If this target executes then the build&lt;br /&gt;
   was allowed otherwise an error will be shown.&lt;br /&gt;
   --&amp;gt;&lt;br /&gt;
   &amp;lt;Target Name="BeforeEndToEndIteration" DependsOnTargets="$(BeforeEndToEndIterationDependsOn)"&amp;gt;&lt;br /&gt;
   &amp;lt;Message Text="EndToEndIteration starting"/&amp;gt;&lt;br /&gt;
   &amp;lt;/Target&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
   &amp;lt;/Project&amp;gt; 
&lt;/p&gt;
&lt;p&gt;
   The only reason that I have defined the allowed build agents in a property (&lt;span style="color:#00b050; font-family:Courier New"&gt;AllowedBuildAgents&lt;/span&gt;)
   is because I want to allow external sources to specify it. You can specify properties
   through the &lt;a href="http://msdn.microsoft.com/en-us/library/ms164311.aspx"&gt;command
   line&lt;/a&gt; or when using the &lt;a href="http://msdn.microsoft.com/en-us/library/7z253716.aspx"&gt;MSBuild
   Task&lt;/a&gt;. Then the script converts this to an item. If I execute this project I would
   expect it to succeed because the defined value for BuildAgentName is contained in
   the list of &lt;span style="color:#00b050; font-family:Courier New"&gt;AllowedBuildAgents&lt;/span&gt;.
   The results of executing this project are shown below. 
&lt;/p&gt;
&lt;p&gt;
   &lt;img src="http://www.sedodream.com/content/binary/062008_0423_MSBuildREEn1.png" alt="" /&gt; 
&lt;/p&gt;
&lt;p&gt;
   Now we can change the value for &lt;span style="color:#00b050; font-family:Courier New"&gt;BuildAgentName&lt;/span&gt;,
   by using the command &lt;span style="color:#00b050; font-family:Courier New"&gt;msbuild.exe
   BuildAgent01.proj /p:BuildAgentName=Sayed_010&lt;/span&gt;. We would expect the build to
   fail. The results of this are below. 
&lt;/p&gt;
&lt;p&gt;
   &lt;img src="http://www.sedodream.com/content/binary/062008_0423_MSBuildREEn2.png" alt="" /&gt; 
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
   So the build failed as expected so we are good. Any questions? 
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
   &lt;a href="http://www.sedodream.com/content/binary/BuildAgent01.proj.txt"&gt;BuildAgent01.proj&lt;/a&gt; 
&lt;/p&gt;
&lt;p&gt;
   Sayed Ibrahim Hashimi
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.sedodream.com/aggbug.ashx?id=096a2e3f-fcff-4715-8d00-73d8f2491a13" /&gt;</description>
      <comments>http://www.sedodream.com/CommentView,guid,096a2e3f-fcff-4715-8d00-73d8f2491a13.aspx</comments>
    </item>
    <item>
      <trackback:ping>http://www.sedodream.com/Trackback.aspx?guid=b3b0d07b-3f21-41ab-9e52-4da8ff268a66</trackback:ping>
      <pingback:server>http://www.sedodream.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.sedodream.com/PermaLink,guid,b3b0d07b-3f21-41ab-9e52-4da8ff268a66.aspx</pingback:target>
      <dc:creator>sayed.hashimi@gmail.com (Sayed Ibrahim Hashimi)</dc:creator>
      <wfw:comment>http://www.sedodream.com/CommentView,guid,b3b0d07b-3f21-41ab-9e52-4da8ff268a66.aspx</wfw:comment>
      <wfw:commentRss>http://www.sedodream.com/SyndicationService.asmx/GetEntryCommentsRss?guid=b3b0d07b-3f21-41ab-9e52-4da8ff268a66</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
      If you are customizing your build process you may need to increase the verbosity that
      Visual Studio uses when building your projects. It is pretty easy to change this value,
      you just go to <span style="font-family:Courier New"><em>Tools-&gt;Options</em></span> then
      find the <span style="font-family:Courier New"><em>Project and Solutions-&gt;Build
      and Run</em></span> node. The dialog is shown here 
   </p>
        <p>
          <a href="http://www.sedodream.com/content/binary/BuildOptions.jpg">
            <img src="http://www.sedodream.com/content/binary/061608_0550_ChangingBui1.png" alt="" border="0" />
          </a>
        </p>
        <p>
      The area where the verbosity setting lies is highlighted. I've got mine set to Detailed,
      which produces a lot of output. If you set it to Diagnostic, then you should be ready
      for a lot of output. Most like much more then you need! 
   </p>
        <p>
          <br />
      Sayed Ibrahim Hashimi
   </p>
        <img width="0" height="0" src="http://www.sedodream.com/aggbug.ashx?id=b3b0d07b-3f21-41ab-9e52-4da8ff268a66" />
      </body>
      <title>Changing Build Verbosity in Visual Studio</title>
      <guid>http://www.sedodream.com/PermaLink,guid,b3b0d07b-3f21-41ab-9e52-4da8ff268a66.aspx</guid>
      <link>http://www.sedodream.com/PermaLink,guid,b3b0d07b-3f21-41ab-9e52-4da8ff268a66.aspx</link>
      <pubDate>Mon, 16 Jun 2008 05:50:26 GMT</pubDate>
      <description>&lt;p&gt;
   If you are customizing your build process you may need to increase the verbosity that
   Visual Studio uses when building your projects. It is pretty easy to change this value,
   you just go to &lt;span style="font-family:Courier New"&gt;&lt;em&gt;Tools-&amp;gt;Options&lt;/em&gt;&lt;/span&gt; then
   find the &lt;span style="font-family:Courier New"&gt;&lt;em&gt;Project and Solutions-&amp;gt;Build
   and Run&lt;/em&gt;&lt;/span&gt; node. The dialog is shown here 
&lt;/p&gt;
&lt;p&gt;
   &lt;a href="http://www.sedodream.com/content/binary/BuildOptions.jpg"&gt;&lt;img src="http://www.sedodream.com/content/binary/061608_0550_ChangingBui1.png" alt="" border="0" /&gt;&lt;/a&gt; 
&lt;/p&gt;
&lt;p&gt;
   The area where the verbosity setting lies is highlighted. I've got mine set to Detailed,
   which produces a lot of output. If you set it to Diagnostic, then you should be ready
   for a lot of output. Most like much more then you need! 
&lt;/p&gt;
&lt;p&gt;
   &lt;br /&gt;
   Sayed Ibrahim Hashimi
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.sedodream.com/aggbug.ashx?id=b3b0d07b-3f21-41ab-9e52-4da8ff268a66" /&gt;</description>
      <comments>http://www.sedodream.com/CommentView,guid,b3b0d07b-3f21-41ab-9e52-4da8ff268a66.aspx</comments>
      <category>MSBuild;Visual Studio</category>
    </item>
    <item>
      <trackback:ping>http://www.sedodream.com/Trackback.aspx?guid=7e11f92e-e778-4e69-9441-9a6be3512e71</trackback:ping>
      <pingback:server>http://www.sedodream.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.sedodream.com/PermaLink,guid,7e11f92e-e778-4e69-9441-9a6be3512e71.aspx</pingback:target>
      <dc:creator>sayed.hashimi@gmail.com (Sayed Ibrahim Hashimi)</dc:creator>
      <wfw:comment>http://www.sedodream.com/CommentView,guid,7e11f92e-e778-4e69-9441-9a6be3512e71.aspx</wfw:comment>
      <wfw:commentRss>http://www.sedodream.com/SyndicationService.asmx/GetEntryCommentsRss?guid=7e11f92e-e778-4e69-9441-9a6be3512e71</wfw:commentRss>
      <slash:comments>1</slash:comments>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
      If you take a look the MSDN documentation for the reserved <a href="http://msdn.microsoft.com/en-us/library/ms164309.aspx">MSBuild
      Reserved Properties</a> you will see many properties listed. For one reason or another
      there are actually several reserved properties that are missing from that list. Here
      is the list of all the reserved properties, the ones missing from that page are presented
      here in <strong>bold</strong>. For those that are listed on that page the description
      is taken from the MSDN. Also this is the list for MSBuild 3.5. 
   </p>
        <p>
        </p>
        <ul>
          <li>
            <div>
              <strong>MSBuildNodeCount </strong>
            </div>
            <ul>
              <li>
               Contains the number of nodes, processes, which is being used to build the project. 
            </li>
            </ul>
          </li>
          <li>
            <div>
              <strong>MSBuildExtensionsPath32 </strong>
            </div>
            <ul>
              <li>
               Path to MSBuild extensions path specifically for the 32 bit directory. If you are
               using a 32 bit machine then this will be the same value as MSBuildExtensionsPath property. 
            </li>
              <li>
               This property can be overridden. 
            </li>
            </ul>
          </li>
          <li>
            <div>
              <strong>MSBuildProjectDirectoryNoRoot </strong>
            </div>
            <ul>
              <li>
               Same as MSBuildProjectDirectory but without the root listed in front. 
            </li>
            </ul>
          </li>
          <li>
            <div>
              <strong>MSBuildToolsPath </strong>
            </div>
            <ul>
              <li>
               Directory for the framework that is used to build the project. 
            </li>
            </ul>
          </li>
          <li>
            <div>
              <strong>MSBuildToolsVersion </strong>
            </div>
            <ul>
              <li>
               Tools version for the current build. 
            </li>
            </ul>
          </li>
          <li>
            <div>MSBuildBinPath 
         </div>
            <ul>
              <li>
               The absolute path of the directory where the MSBuild binaries that are currently being
               used are located, for example, C:\Windows\Microsoft.Net\Framework\v2.0. This property
               is useful if you need to refer to files in the MSBuild directory. 
            </li>
            </ul>
          </li>
          <li>
            <div>MSBuildExtensionsPath 
         </div>
            <ul>
              <li>
               The MSBuild folder under the Program Files directory. This location is a useful place
               to put custom target files. For example, your targets files could be installed at
               \Program Files\MSBuild\MyFiles\Northwind.targets and then imported in project files
               with the following XML. 
               <br />
               &lt;Import Project="$(MSBuildExtensionsPath)\MyFiles\Northwind.targets"/&gt;<br />
               This property can be overridden. 
            </li>
            </ul>
          </li>
          <li>
            <div>MSBuildProjectDefaultTargets 
         </div>
            <ul>
              <li>
               The complete list of targets specified in the DefaultTargets attribute of the Project
               element. For example, the following Project element would have an MSBuildDefaultTargets
               property value of A;B;C. 
               <br />
               &lt;Project DefaultTargets="A;B;C" &gt; 
            </li>
            </ul>
          </li>
          <li>
            <div>MSBuildProjectDirectory 
         </div>
            <ul>
              <li>
               The absolute path of the directory where the project file is located, for example,
               C:\MyCompany\MyProduct. 
            </li>
            </ul>
          </li>
          <li>
            <div>MSBuildProjectExtension 
         </div>
            <ul>
              <li>
               The file name extension of the project file, including the period, for example, .proj. 
            </li>
            </ul>
          </li>
          <li>
            <div>MSBuildProjectFile 
         </div>
            <ul>
              <li>
               The complete file name of the project file, including the file name extension, for
               example, MyApp.proj. 
            </li>
            </ul>
          </li>
          <li>
            <div>MSBuildProjectFullPath 
         </div>
            <ul>
              <li>
               The absolute path and complete file name of the project file, for example, C:\MyCompany\MyProduct\MyApp.proj. 
            </li>
            </ul>
          </li>
          <li>
            <div>MSBuildProjectName 
         </div>
            <ul>
              <li>
               The file name of the project file without the file name extension, for example, MyApp. 
            </li>
            </ul>
          </li>
          <li>
            <div>MSBuildStartupDirectory 
         </div>
            <ul>
              <li>
               The absolute path of the directory where MSBuild is invoked. 
            </li>
            </ul>
          </li>
        </ul>
        <p>
        </p>
        <p>
      Take a look at this project file that prints out these values. 
   </p>
        <p style="background: #d9d9d9">
      &lt;Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003" 
      <br />
      DefaultTargets="PrintProperties" 
      <br />
      ToolsVersion="3.5"&gt; 
   </p>
        <p style="background: #d9d9d9">
      &lt;Target Name="PrintProperties"&gt;<br />
      &lt;Message Text="MSBuildNodeCount: $(MSBuildNodeCount)"/&gt;<br />
      &lt;Message Text="MSBuildExtensionsPath32: $(MSBuildExtensionsPath32)"/&gt;<br />
      &lt;Message Text="MSBuildProjectDirectoryNoRoot: $(MSBuildProjectDirectoryNoRoot)"/&gt;<br />
      &lt;Message Text="MSBuildToolsPath: $(MSBuildToolsPath)"/&gt;<br />
      &lt;Message Text="MSBuildToolsVersion: $(MSBuildToolsVersion)"/&gt;<br />
      &lt;Message Text="MSBuildBinPath: $(MSBuildBinPath)"/&gt;<br />
      &lt;Message Text="MSBuildExtensionsPath: $(MSBuildExtensionsPath)"/&gt;<br />
      &lt;Message Text="MSBuildProjectDefaultTargets: $(MSBuildProjectDefaultTargets)"/&gt;<br />
      &lt;Message Text="MSBuildProjectDirectory: $(MSBuildProjectDirectory)"/&gt; 
      <br />
      &lt;Message Text="MSBuildProjectExtension: $(MSBuildProjectExtension)"/&gt;<br />
      &lt;Message Text="MSBuildProjectFile: $(MSBuildProjectFile)"/&gt;<br />
      &lt;Message Text="MSBuildProjectFullPath: $(MSBuildProjectFullPath)"/&gt;<br />
      &lt;Message Text="MSBuildProjectName: $(MSBuildProjectName)"/&gt;<br />
      &lt;Message Text="MSBuildStartupDirectory: $(MSBuildStartupDirectory)"/&gt; 
   </p>
        <p style="background: #d9d9d9">
      &lt;/Target&gt;<br />
      &lt;/Project&gt; 
   </p>
        <p>
      If you execute this you will get something like what's shown here. 
   </p>
        <p>
          <img src="http://www.sedodream.com/content/binary/060908_0552_MSBuildRese1.png" alt="" />
        </p>
        <p>
        </p>
        <p>
      I'm not sure how important this, but you may need to know one day. 
   </p>
        <p>
          <a href="http://www.sedodream.com/content/binary/ReservedProperties.proj.txt">ReservedProperties.proj</a>
        </p>
        <p>
      Sayed Ibrahim Hashimi
   </p>
        <img width="0" height="0" src="http://www.sedodream.com/aggbug.ashx?id=7e11f92e-e778-4e69-9441-9a6be3512e71" />
      </body>
      <title>MSBuild Reserved Properties</title>
      <guid>http://www.sedodream.com/PermaLink,guid,7e11f92e-e778-4e69-9441-9a6be3512e71.aspx</guid>
      <link>http://www.sedodream.com/PermaLink,guid,7e11f92e-e778-4e69-9441-9a6be3512e71.aspx</link>
      <pubDate>Mon, 09 Jun 2008 05:52:31 GMT</pubDate>
      <description>&lt;p&gt;
   If you take a look the MSDN documentation for the reserved &lt;a href="http://msdn.microsoft.com/en-us/library/ms164309.aspx"&gt;MSBuild
   Reserved Properties&lt;/a&gt; you will see many properties listed. For one reason or another
   there are actually several reserved properties that are missing from that list. Here
   is the list of all the reserved properties, the ones missing from that page are presented
   here in &lt;strong&gt;bold&lt;/strong&gt;. For those that are listed on that page the description
   is taken from the MSDN. Also this is the list for MSBuild 3.5. 
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;ul&gt;
   &lt;li&gt;
      &lt;div&gt;&lt;strong&gt;MSBuildNodeCount &lt;/strong&gt;
      &lt;/div&gt;
      &lt;ul&gt;
         &lt;li&gt;
            Contains the number of nodes, processes, which is being used to build the project. 
         &lt;/li&gt;
      &lt;/ul&gt;
   &lt;/li&gt;
   &lt;li&gt;
      &lt;div&gt;&lt;strong&gt;MSBuildExtensionsPath32 &lt;/strong&gt;
      &lt;/div&gt;
      &lt;ul&gt;
         &lt;li&gt;
            Path to MSBuild extensions path specifically for the 32 bit directory. If you are
            using a 32 bit machine then this will be the same value as MSBuildExtensionsPath property. 
         &lt;/li&gt;
         &lt;li&gt;
            This property can be overridden. 
         &lt;/li&gt;
      &lt;/ul&gt;
   &lt;/li&gt;
   &lt;li&gt;
      &lt;div&gt;&lt;strong&gt;MSBuildProjectDirectoryNoRoot &lt;/strong&gt;
      &lt;/div&gt;
      &lt;ul&gt;
         &lt;li&gt;
            Same as MSBuildProjectDirectory but without the root listed in front. 
         &lt;/li&gt;
      &lt;/ul&gt;
   &lt;/li&gt;
   &lt;li&gt;
      &lt;div&gt;&lt;strong&gt;MSBuildToolsPath &lt;/strong&gt;
      &lt;/div&gt;
      &lt;ul&gt;
         &lt;li&gt;
            Directory for the framework that is used to build the project. 
         &lt;/li&gt;
      &lt;/ul&gt;
   &lt;/li&gt;
   &lt;li&gt;
      &lt;div&gt;&lt;strong&gt;MSBuildToolsVersion &lt;/strong&gt;
      &lt;/div&gt;
      &lt;ul&gt;
         &lt;li&gt;
            Tools version for the current build. 
         &lt;/li&gt;
      &lt;/ul&gt;
   &lt;/li&gt;
   &lt;li&gt;
      &lt;div&gt;MSBuildBinPath 
      &lt;/div&gt;
      &lt;ul&gt;
         &lt;li&gt;
            The absolute path of the directory where the MSBuild binaries that are currently being
            used are located, for example, C:\Windows\Microsoft.Net\Framework\v2.0. This property
            is useful if you need to refer to files in the MSBuild directory. 
         &lt;/li&gt;
      &lt;/ul&gt;
   &lt;/li&gt;
   &lt;li&gt;
      &lt;div&gt;MSBuildExtensionsPath 
      &lt;/div&gt;
      &lt;ul&gt;
         &lt;li&gt;
            The MSBuild folder under the Program Files directory. This location is a useful place
            to put custom target files. For example, your targets files could be installed at
            \Program Files\MSBuild\MyFiles\Northwind.targets and then imported in project files
            with the following XML. 
            &lt;br /&gt;
            &amp;lt;Import Project="$(MSBuildExtensionsPath)\MyFiles\Northwind.targets"/&amp;gt;&lt;br /&gt;
            This property can be overridden. 
         &lt;/li&gt;
      &lt;/ul&gt;
   &lt;/li&gt;
   &lt;li&gt;
      &lt;div&gt;MSBuildProjectDefaultTargets 
      &lt;/div&gt;
      &lt;ul&gt;
         &lt;li&gt;
            The complete list of targets specified in the DefaultTargets attribute of the Project
            element. For example, the following Project element would have an MSBuildDefaultTargets
            property value of A;B;C. 
            &lt;br /&gt;
            &amp;lt;Project DefaultTargets="A;B;C" &amp;gt; 
         &lt;/li&gt;
      &lt;/ul&gt;
   &lt;/li&gt;
   &lt;li&gt;
      &lt;div&gt;MSBuildProjectDirectory 
      &lt;/div&gt;
      &lt;ul&gt;
         &lt;li&gt;
            The absolute path of the directory where the project file is located, for example,
            C:\MyCompany\MyProduct. 
         &lt;/li&gt;
      &lt;/ul&gt;
   &lt;/li&gt;
   &lt;li&gt;
      &lt;div&gt;MSBuildProjectExtension 
      &lt;/div&gt;
      &lt;ul&gt;
         &lt;li&gt;
            The file name extension of the project file, including the period, for example, .proj. 
         &lt;/li&gt;
      &lt;/ul&gt;
   &lt;/li&gt;
   &lt;li&gt;
      &lt;div&gt;MSBuildProjectFile 
      &lt;/div&gt;
      &lt;ul&gt;
         &lt;li&gt;
            The complete file name of the project file, including the file name extension, for
            example, MyApp.proj. 
         &lt;/li&gt;
      &lt;/ul&gt;
   &lt;/li&gt;
   &lt;li&gt;
      &lt;div&gt;MSBuildProjectFullPath 
      &lt;/div&gt;
      &lt;ul&gt;
         &lt;li&gt;
            The absolute path and complete file name of the project file, for example, C:\MyCompany\MyProduct\MyApp.proj. 
         &lt;/li&gt;
      &lt;/ul&gt;
   &lt;/li&gt;
   &lt;li&gt;
      &lt;div&gt;MSBuildProjectName 
      &lt;/div&gt;
      &lt;ul&gt;
         &lt;li&gt;
            The file name of the project file without the file name extension, for example, MyApp. 
         &lt;/li&gt;
      &lt;/ul&gt;
   &lt;/li&gt;
   &lt;li&gt;
      &lt;div&gt;MSBuildStartupDirectory 
      &lt;/div&gt;
      &lt;ul&gt;
         &lt;li&gt;
            The absolute path of the directory where MSBuild is invoked. 
         &lt;/li&gt;
      &lt;/ul&gt;
   &lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
   Take a look at this project file that prints out these values. 
&lt;/p&gt;
&lt;p style="background: #d9d9d9"&gt;
   &amp;lt;Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003" 
   &lt;br /&gt;
   DefaultTargets="PrintProperties" 
   &lt;br /&gt;
   ToolsVersion="3.5"&amp;gt; 
&lt;/p&gt;
&lt;p style="background: #d9d9d9"&gt;
   &amp;lt;Target Name="PrintProperties"&amp;gt;&lt;br /&gt;
   &amp;lt;Message Text="MSBuildNodeCount: $(MSBuildNodeCount)"/&amp;gt;&lt;br /&gt;
   &amp;lt;Message Text="MSBuildExtensionsPath32: $(MSBuildExtensionsPath32)"/&amp;gt;&lt;br /&gt;
   &amp;lt;Message Text="MSBuildProjectDirectoryNoRoot: $(MSBuildProjectDirectoryNoRoot)"/&amp;gt;&lt;br /&gt;
   &amp;lt;Message Text="MSBuildToolsPath: $(MSBuildToolsPath)"/&amp;gt;&lt;br /&gt;
   &amp;lt;Message Text="MSBuildToolsVersion: $(MSBuildToolsVersion)"/&amp;gt;&lt;br /&gt;
   &amp;lt;Message Text="MSBuildBinPath: $(MSBuildBinPath)"/&amp;gt;&lt;br /&gt;
   &amp;lt;Message Text="MSBuildExtensionsPath: $(MSBuildExtensionsPath)"/&amp;gt;&lt;br /&gt;
   &amp;lt;Message Text="MSBuildProjectDefaultTargets: $(MSBuildProjectDefaultTargets)"/&amp;gt;&lt;br /&gt;
   &amp;lt;Message Text="MSBuildProjectDirectory: $(MSBuildProjectDirectory)"/&amp;gt; 
   &lt;br /&gt;
   &amp;lt;Message Text="MSBuildProjectExtension: $(MSBuildProjectExtension)"/&amp;gt;&lt;br /&gt;
   &amp;lt;Message Text="MSBuildProjectFile: $(MSBuildProjectFile)"/&amp;gt;&lt;br /&gt;
   &amp;lt;Message Text="MSBuildProjectFullPath: $(MSBuildProjectFullPath)"/&amp;gt;&lt;br /&gt;
   &amp;lt;Message Text="MSBuildProjectName: $(MSBuildProjectName)"/&amp;gt;&lt;br /&gt;
   &amp;lt;Message Text="MSBuildStartupDirectory: $(MSBuildStartupDirectory)"/&amp;gt; 
&lt;/p&gt;
&lt;p style="background: #d9d9d9"&gt;
   &amp;lt;/Target&amp;gt;&lt;br /&gt;
   &amp;lt;/Project&amp;gt; 
&lt;/p&gt;
&lt;p&gt;
   If you execute this you will get something like what's shown here. 
&lt;/p&gt;
&lt;p&gt;
   &lt;img src="http://www.sedodream.com/content/binary/060908_0552_MSBuildRese1.png" alt="" /&gt; 
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
   I'm not sure how important this, but you may need to know one day. 
&lt;/p&gt;
&lt;p&gt;
   &lt;a href="http://www.sedodream.com/content/binary/ReservedProperties.proj.txt"&gt;ReservedProperties.proj&lt;/a&gt; 
&lt;/p&gt;
&lt;p&gt;
   Sayed Ibrahim Hashimi
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.sedodream.com/aggbug.ashx?id=7e11f92e-e778-4e69-9441-9a6be3512e71" /&gt;</description>
      <comments>http://www.sedodream.com/CommentView,guid,7e11f92e-e778-4e69-9441-9a6be3512e71.aspx</comments>
      <category>MSBuild</category>
    </item>
    <item>
      <trackback:ping>http://www.sedodream.com/Trackback.aspx?guid=0a779774-4405-44e4-98a1-af91c1ad8269</trackback:ping>
      <pingback:server>http://www.sedodream.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.sedodream.com/PermaLink,guid,0a779774-4405-44e4-98a1-af91c1ad8269.aspx</pingback:target>
      <dc:creator>sayed.hashimi@gmail.com (Sayed Ibrahim Hashimi)</dc:creator>
      <wfw:comment>http://www.sedodream.com/CommentView,guid,0a779774-4405-44e4-98a1-af91c1ad8269.aspx</wfw:comment>
      <wfw:commentRss>http://www.sedodream.com/SyndicationService.asmx/GetEntryCommentsRss?guid=0a779774-4405-44e4-98a1-af91c1ad8269</wfw:commentRss>
      <title>DataContract XML Helper</title>
      <guid>http://www.sedodream.com/PermaLink,guid,0a779774-4405-44e4-98a1-af91c1ad8269.aspx</guid>
      <link>http://www.sedodream.com/PermaLink,guid,0a779774-4405-44e4-98a1-af91c1ad8269.aspx</link>
      <pubDate>Wed, 04 Jun 2008 05:54:58 GMT</pubDate>
      <description>&lt;p&gt;
   Lately I've been doing some work with WCF and I have had a need to easily convert
   from object-&amp;gt;XML and from XML-&amp;gt;object. These XML strings were created using
   the &lt;a href="http://msdn.microsoft.com/en-us/library/system.runtime.serialization.datacontractserializer.aspx"&gt;DataContractSerializer&lt;/a&gt;.
   So I threw together this util class [yeah I know I probably shouldn't have these,
   but you know you do too &lt;span style="FONT-FAMILY: Wingdings"&gt;J&lt;/span&gt; ]. There are
   really 2 methods &lt;em&gt;GetDataContractXml&lt;/em&gt; and &lt;em&gt;BuildFromDataContractXml&lt;/em&gt;.
   The &lt;em&gt;GetDataContractXml&lt;/em&gt; returns the XML for the object provided and the &lt;em&gt;BuildFromDataContractXml&lt;/em&gt; method
   will create the object from the XML string. These methods have both a generic and
   non-generic method. The non-generic versions are particularly useful if you are using
   this with reflection. Anywayz, the class itself is shown below, and you can download
   the file at the bottom of this post. 
&lt;/p&gt;
&lt;pre&gt;///
/// © Copyright Sayed Ibrahim Hashimi
/// www.sedodream.com
///
using System;
using System.IO;
using System.Xml;
using System.Reflection;
using System.Runtime.Serialization;
using System.Text;
using System.Xml.Serialization;
namespace Sedodream.Sample.Serialization01.Util
{
    public static class XmlUtils
    {
        /// 
&lt;SUMMARY&gt;
   /// Builds an object of the specified type from the given /// XML representation that
   can be passed to the DataContractSerializer /// 
&lt;/SUMMARY&gt;
public static object BuildFromDataContractXml(string xml, Type type) { if (string.IsNullOrEmpty(xml))
{throw new ArgumentNullException("xml"); } if (type == null) { throw new ArgumentNullException("type");
} object result = null; DataContractSerializer dcs = new DataContractSerializer(type);
using (StringReader reader = new StringReader(xml)) using (XmlReader xmlReader = new
XmlTextReader(reader)) { result = dcs.ReadObject(xmlReader); } return result; } /// 
&lt;SUMMARY&gt;
   /// Builds an object from its XML /// representation that can be passed to the DataContractSerializer.
   /// 
&lt;/SUMMARY&gt;
public static T BuildFromDataContractXml&lt;T&gt;
   (string xml) { if (string.IsNullOrEmpty(xml)) { throw new ArgumentNullException("xml");
   } T result = default(T); object objResult = BuildFromDataContractXml(xml, typeof(T));
   if (objResult != null) { result = (T)objResult; } return result; } /// 
   &lt;SUMMARY&gt;
      /// Gets the XML representation of the given object /// by using the DataContracSerializer.
      /// 
   &lt;/SUMMARY&gt;
   public static string GetDataContractXml&lt;T&gt;
      (T obj) { if (obj == null) { throw new ArgumentNullException("obj"); } return GetDataContractXml(obj.GetType(),
      obj); } /// 
      &lt;SUMMARY&gt;
         /// Gets the XML representation of the given object /// of specfiied 
         &lt;C&gt;
            type
         &lt;/C&gt;
         by using the DataContracSerializer. /// 
      &lt;/SUMMARY&gt;
      public static string GetDataContractXml(Type type, object val) { if (type == null)
      { throw new ArgumentNullException("type"); } if (val == null) { throw new ArgumentNullException("val");
      } MemoryStream ms = new MemoryStream(); string xml = null; try { DataContractSerializer
      dcs = new DataContractSerializer(type); using (XmlTextWriter xmlTextWriter = new XmlTextWriter(ms,
      System.Text.Encoding.Default)) { xmlTextWriter.Formatting = System.Xml.Formatting.Indented;
      dcs.WriteObject(xmlTextWriter, val); xmlTextWriter.Flush(); ms = (MemoryStream)xmlTextWriter.BaseStream;
      ms.Flush(); xml = UTF8ByteArrayToString(ms.ToArray()); } } finally { if (ms != null)
      { ms.Close(); ms = null; } } return xml; } /// 
      &lt;SUMMARY&gt;
         /// Writes the XML representation from the DataContractSerializer /// into the specified
         filename. If a file at 
         &lt;C&gt;
            filename
         &lt;/C&gt;
         /// already exists then an 
         &lt;C&gt;
            Exception
         &lt;/C&gt;
         will be thrown. /// 
      &lt;/SUMMARY&gt;
      public static void WriteDateContractToFile&lt;T&gt;
         (string filename, T obj) { WriteDateContractToFile(filename, obj.GetType(), obj);
         } /// 
         &lt;SUMMARY&gt;
            /// Writes the XML representation from the DataContractSerializer /// into the specified
            filename. If a file at 
            &lt;C&gt;
               filename
            &lt;/C&gt;
            /// already exists then an 
            &lt;C&gt;
               Exception
            &lt;/C&gt;
            will be thrown. /// 
         &lt;/SUMMARY&gt;
         public static void WriteDateContractToFile(string filename, Type type, object val)
         { if (string.IsNullOrEmpty(filename)) { throw new ArgumentNullException("filename");
         } if (val == null) { throw new ArgumentNullException("val"); } if (File.Exists(filename))
         { throw new ArgumentException("filname"); } //TODO: Stream this into the file instead
         of this!!! File.WriteAllText(filename, GetDataContractXml(type, val)); } private static
         String UTF8ByteArrayToString(Byte[] characters) { UTF8Encoding encoding = new UTF8Encoding();
         string constructedString = encoding.GetString(characters); return (constructedString);
         } private static Byte[] StringToUTF8ByteArray(String pXmlString) { UTF8Encoding encoding
         = new UTF8Encoding(); byte[] byteArray = encoding.GetBytes(pXmlString); return byteArray;
         } } } 
&lt;/pre&gt;
&lt;p&gt;
   To show how this can be used here is a quick sample unit test shown below, this will
   be a part of a later post on a related topic. 
&lt;/p&gt;
&lt;p style="MARGIN-LEFT: 38pt"&gt;
&lt;pre&gt;using System;
using System.Collections.Generic;
using System.Text;
using NUnit.Framework;
using Sedodream.Sample.Serialization01;
using Sedodream.Sample.Serialization01.Util;

namespace unittest.Sedodream.Sample.Serialization01
{
    [TestFixture]
    public class TestXmlUtils
    {
        [Test]
        public void TestCreateXml()
        {
            string name = "Sayed Ibrahim Hashimi";
            string email = "sayed.hashimi@gmail.com";


            Person person = new Person();
            person.Name = name;
            person.Email = email;

            string xml = XmlUtils.GetDataContractXml&lt;PERSON&gt;
   (person); Assert.IsTrue(!string.IsNullOrEmpty(xml)); Assert.IsTrue(xml.Contains(name));
   Assert.IsTrue(xml.Contains(email)); } [Test] public void TestCreateFromXml() { const
   string xml = @"&lt;PERSON xmlns="" http: 04?? 2008 Serialization schemas.sedodream.com XMLSchema-instance?? 2001 www.w3.org xmlns:i=""&gt;
      &lt;EMAIL&gt;
         sayed.hashimi@gmail.com
      &lt;/EMAIL&gt;
      &lt;ID&gt;
         9891668d-8107-4f3e-85a4-79e941453be2
      &lt;/ID&gt;
      &lt;NAME&gt;
         Sayed Ibrahim Hashimi
      &lt;/NAME&gt;
   &lt;/PERSON&gt;
   "; string name = "Sayed Ibrahim Hashimi"; string email = "sayed.hashimi@gmail.com";
   Guid id = new Guid("9891668d-8107-4f3e-85a4-79e941453be2"); Person person = XmlUtils.BuildFromDataContractXml&lt;PERSON&gt;
      (xml); Assert.IsNotNull(person); Assert.AreEqual(name, person.Name); Assert.AreEqual(email,
      person.Email); Assert.AreEqual(id, person.Id); } } } 
&lt;/pre&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
   Where the simple Person class is shown here 
&lt;/p&gt;
&lt;p style="MARGIN-LEFT: 38pt"&gt;
&lt;pre&gt;[DataContract(Namespace="http://schemas.sedodream.com/Serialization/2008/04")]
public class Person
{
    #region Constructors
    public Person()
    {
        Id = Guid.NewGuid();
    }
    #endregion

    [DataMember]
    public string Name
    {
        get;
        set;
    }
    [DataMember]
    public string Email
    {
        get;
        set;
    }
    [DataMember]
    public Guid Id
    {
        get;
        set;
    }
}
&lt;/pre&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
   From the two simply test you can see how to create the object from the XML string
   and vice versa. As far as I know these work pretty good, if you find any issues please
   let me know and I can update them. At some point I will post some more information
   that is related to this keep an eye for it. 
&lt;/p&gt;
&lt;p&gt;
   &amp;nbsp;
&lt;/p&gt;
&lt;p&gt;
   &lt;a href="http://www.sedodream.com/content/binary/XmlUtils.cs.txt"&gt;XmlUtils.cs&lt;/a&gt; 
&lt;/p&gt;
&lt;p&gt;
   Sayed Ibrahim Hashimi
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.sedodream.com/aggbug.ashx?id=0a779774-4405-44e4-98a1-af91c1ad8269" /&gt;</description>
      <comments>http://www.sedodream.com/CommentView,guid,0a779774-4405-44e4-98a1-af91c1ad8269.aspx</comments>
      <category>DataContractSerializer;WCF</category>
    </item>
    <item>
      <trackback:ping>http://www.sedodream.com/Trackback.aspx?guid=2e12b6f3-5aaa-47bc-958e-2cea5c6ff902</trackback:ping>
      <pingback:server>http://www.sedodream.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.sedodream.com/PermaLink,guid,2e12b6f3-5aaa-47bc-958e-2cea5c6ff902.aspx</pingback:target>
      <dc:creator>sayed.hashimi@gmail.com (Sayed Ibrahim Hashimi)</dc:creator>
      <wfw:comment>http://www.sedodream.com/CommentView,guid,2e12b6f3-5aaa-47bc-958e-2cea5c6ff902.aspx</wfw:comment>
      <wfw:commentRss>http://www.sedodream.com/SyndicationService.asmx/GetEntryCommentsRss?guid=2e12b6f3-5aaa-47bc-958e-2cea5c6ff902</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
      Ok there is this hidden feature of MSBuild its called output inferral. This is used
      when a target is skipped due its Inputs &amp; Outputs (incremental building) but the
      target creates properties and items. Eventhough the inputs and outputs are up to date
      the side effects (properties &amp; items) may change the rest of the build process.
      Because of this output inferral is required. When a target is skipped MSBuild will
      inspect the target for properties &amp; items that were created and create those.
      This will ensure that other targets down the chain will not be affected by the target
      being skipped. In MSBuild 3.5 there is a new property on the <a href="http://msdn.microsoft.com/en-us/library/63ckb9s9.aspx">CreateProperty</a> task,
      this property is ValueSetByTask. The whole purpose of this is to only be used when
      you do not want its value to be inferred. By using this property instead of Value
      you would be guaranteed that the target was actually executed. Let's clear this up
      with an example take a look at the project file shown below. 
   </p>
        <p style="margin-left: 38pt">
          <span style="color:black; font-family:Lucida Sans Typewriter; font-size:7pt">&lt;Project
      xmlns="http://schemas.microsoft.com/developer/msbuild/2003"&gt;<br /><br />
      &lt;!-- 
      <br />
      This target will always be skipped .<br />
      Neither property One or Two exists but One will be inferred<br />
      by MSBuild.<br />
      --&gt;<br />
      &lt;Target Name="SetupValues" 
      <br />
      Inputs="$(MSBuildProjectFullPath)" 
      <br />
      Outputs="$(MSBuildProjectFullPath)"&gt;<br /><br />
      &lt;Message Text="SetuptValues Executed!" Importance="high"/&gt; 
      <br /><br />
      &lt;CreateProperty Value="1111"&gt;<br />
      &lt;Output PropertyName="One" TaskParameter="Value"/&gt;<br />
      &lt;!-- Property One is actually inferred by this statement. --&gt;<br />
      &lt;/CreateProperty&gt;<br />
      &lt;CreateProperty Value="2222"&gt;<br />
      &lt;Output PropertyName="Two" TaskParameter="<span style="background-color:yellow"><strong>ValueSetByTask</strong></span>"/&gt;<br />
      &lt;!-- Using ValueSetByTask we can ensure bypassing any inferring here --&gt;<br />
      &lt;/CreateProperty&gt;<br /><br />
      &lt;PropertyGroup&gt;<br />
      &lt;!-- 3.5 syntax: Property Three is also inferred --&gt;<br />
      &lt;Three&gt;3333&lt;/Three&gt;<br />
      &lt;/PropertyGroup&gt;<br /><br />
      &lt;!-- Items are inferred too! --&gt;<br />
      &lt;ItemGroup&gt;<br />
      &lt;File Include="app.config"/&gt;<br />
      &lt;/ItemGroup&gt;<br />
      &lt;/Target&gt;<br /><br />
      &lt;Target Name="PrintValues" DependsOnTargets="SetupValues"&gt;<br />
      &lt;Message Text="One: $(One)" /&gt;<br />
      &lt;Message Text="Two: $(Two)" /&gt;<br />
      &lt;Message Text="Three: $(Three)"/&gt;<br />
      &lt;Message Text="File: @(File)"/&gt;<br />
      &lt;/Target&gt;<br /><br />
      &lt;/Project&gt; </span>
        </p>
        <p>
      In this file <em>(you can download from link at end)</em> there are two targets, SetupValues
      and PrintValues. PrintValues depends on SetupValues. Because the Inputs and Outputs
      on SetupValues point to the same file the target will <strong>always</strong> be skipped.
      But we declare properties and items so they have to be inferred by the MSBuidl engine
      so that the remainder of the build will not be hosed because of it. If you execute
      the PrintValues target the result would be what you see in the image below. 
   </p>
        <p>
          <img src="http://www.sedodream.com/content/binary/052208_0509_MSBuildOutp1.png" alt="" />
        </p>
        <p>
      As you can see the values for the properties <em>One</em> &amp; <em>Three</em> were
      provided by inference but the value for <em>Two</em> was passed over because it uses
      the <em>ValueSetByTask</em> instead of <em>Value</em>. I would suggest that you continue
      to use the <em>Value</em> property and not the <em>ValueSetByTask</em> unless you
      are trying to detect this exact scenario, which most of the time shouldn't matter
      anywayz. 
   </p>
        <p>
          <a href="http://www.sedodream.com/content/binary/OutputInferral.proj.txt">OutputInferral.proj</a>
        </p>
        <p>
          <br />
      Sayed Ibrahim Hashimi
   </p>
        <img width="0" height="0" src="http://www.sedodream.com/aggbug.ashx?id=2e12b6f3-5aaa-47bc-958e-2cea5c6ff902" />
      </body>
      <title>MSBuild Output Inferral and CreateProperty.ValueSetByTask</title>
      <guid>http://www.sedodream.com/PermaLink,guid,2e12b6f3-5aaa-47bc-958e-2cea5c6ff902.aspx</guid>
      <link>http://www.sedodream.com/PermaLink,guid,2e12b6f3-5aaa-47bc-958e-2cea5c6ff902.aspx</link>
      <pubDate>Thu, 22 May 2008 05:09:41 GMT</pubDate>
      <description>&lt;p&gt;
   Ok there is this hidden feature of MSBuild its called output inferral. This is used
   when a target is skipped due its Inputs &amp;amp; Outputs (incremental building) but the
   target creates properties and items. Eventhough the inputs and outputs are up to date
   the side effects (properties &amp;amp; items) may change the rest of the build process.
   Because of this output inferral is required. When a target is skipped MSBuild will
   inspect the target for properties &amp;amp; items that were created and create those.
   This will ensure that other targets down the chain will not be affected by the target
   being skipped. In MSBuild 3.5 there is a new property on the &lt;a href="http://msdn.microsoft.com/en-us/library/63ckb9s9.aspx"&gt;CreateProperty&lt;/a&gt; task,
   this property is ValueSetByTask. The whole purpose of this is to only be used when
   you do not want its value to be inferred. By using this property instead of Value
   you would be guaranteed that the target was actually executed. Let's clear this up
   with an example take a look at the project file shown below. 
&lt;/p&gt;
&lt;p style="margin-left: 38pt"&gt;
   &lt;span style="color:black; font-family:Lucida Sans Typewriter; font-size:7pt"&gt;&amp;lt;Project
   xmlns="http://schemas.microsoft.com/developer/msbuild/2003"&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
   &amp;lt;!-- 
   &lt;br /&gt;
   This target will always be skipped .&lt;br /&gt;
   Neither property One or Two exists but One will be inferred&lt;br /&gt;
   by MSBuild.&lt;br /&gt;
   --&amp;gt;&lt;br /&gt;
   &amp;lt;Target Name="SetupValues" 
   &lt;br /&gt;
   Inputs="$(MSBuildProjectFullPath)" 
   &lt;br /&gt;
   Outputs="$(MSBuildProjectFullPath)"&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
   &amp;lt;Message Text="SetuptValues Executed!" Importance="high"/&amp;gt; 
   &lt;br /&gt;
   &lt;br /&gt;
   &amp;lt;CreateProperty Value="1111"&amp;gt;&lt;br /&gt;
   &amp;lt;Output PropertyName="One" TaskParameter="Value"/&amp;gt;&lt;br /&gt;
   &amp;lt;!-- Property One is actually inferred by this statement. --&amp;gt;&lt;br /&gt;
   &amp;lt;/CreateProperty&amp;gt;&lt;br /&gt;
   &amp;lt;CreateProperty Value="2222"&amp;gt;&lt;br /&gt;
   &amp;lt;Output PropertyName="Two" TaskParameter="&lt;span style="background-color:yellow"&gt;&lt;strong&gt;ValueSetByTask&lt;/strong&gt;&lt;/span&gt;"/&amp;gt;&lt;br /&gt;
   &amp;lt;!-- Using ValueSetByTask we can ensure bypassing any inferring here --&amp;gt;&lt;br /&gt;
   &amp;lt;/CreateProperty&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
   &amp;lt;PropertyGroup&amp;gt;&lt;br /&gt;
   &amp;lt;!-- 3.5 syntax: Property Three is also inferred --&amp;gt;&lt;br /&gt;
   &amp;lt;Three&amp;gt;3333&amp;lt;/Three&amp;gt;&lt;br /&gt;
   &amp;lt;/PropertyGroup&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
   &amp;lt;!-- Items are inferred too! --&amp;gt;&lt;br /&gt;
   &amp;lt;ItemGroup&amp;gt;&lt;br /&gt;
   &amp;lt;File Include="app.config"/&amp;gt;&lt;br /&gt;
   &amp;lt;/ItemGroup&amp;gt;&lt;br /&gt;
   &amp;lt;/Target&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
   &amp;lt;Target Name="PrintValues" DependsOnTargets="SetupValues"&amp;gt;&lt;br /&gt;
   &amp;lt;Message Text="One: $(One)" /&amp;gt;&lt;br /&gt;
   &amp;lt;Message Text="Two: $(Two)" /&amp;gt;&lt;br /&gt;
   &amp;lt;Message Text="Three: $(Three)"/&amp;gt;&lt;br /&gt;
   &amp;lt;Message Text="File: @(File)"/&amp;gt;&lt;br /&gt;
   &amp;lt;/Target&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
   &amp;lt;/Project&amp;gt; &lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
   In this file &lt;em&gt;(you can download from link at end)&lt;/em&gt; there are two targets, SetupValues
   and PrintValues. PrintValues depends on SetupValues. Because the Inputs and Outputs
   on SetupValues point to the same file the target will &lt;strong&gt;always&lt;/strong&gt; be skipped.
   But we declare properties and items so they have to be inferred by the MSBuidl engine
   so that the remainder of the build will not be hosed because of it. If you execute
   the PrintValues target the result would be what you see in the image below. 
&lt;/p&gt;
&lt;p&gt;
   &lt;img src="http://www.sedodream.com/content/binary/052208_0509_MSBuildOutp1.png" alt="" /&gt; 
&lt;/p&gt;
&lt;p&gt;
   As you can see the values for the properties &lt;em&gt;One&lt;/em&gt; &amp;amp; &lt;em&gt;Three&lt;/em&gt; were
   provided by inference but the value for &lt;em&gt;Two&lt;/em&gt; was passed over because it uses
   the &lt;em&gt;ValueSetByTask&lt;/em&gt; instead of &lt;em&gt;Value&lt;/em&gt;. I would suggest that you continue
   to use the &lt;em&gt;Value&lt;/em&gt; property and not the &lt;em&gt;ValueSetByTask&lt;/em&gt; unless you
   are trying to detect this exact scenario, which most of the time shouldn't matter
   anywayz. 
&lt;/p&gt;
&lt;p&gt;
   &lt;a href="http://www.sedodream.com/content/binary/OutputInferral.proj.txt"&gt;OutputInferral.proj&lt;/a&gt; 
&lt;/p&gt;
&lt;p&gt;
   &lt;br /&gt;
   Sayed Ibrahim Hashimi
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.sedodream.com/aggbug.ashx?id=2e12b6f3-5aaa-47bc-958e-2cea5c6ff902" /&gt;</description>
      <comments>http://www.sedodream.com/CommentView,guid,2e12b6f3-5aaa-47bc-958e-2cea5c6ff902.aspx</comments>
      <category>MSBuild</category>
    </item>
    <item>
      <trackback:ping>http://www.sedodream.com/Trackback.aspx?guid=9b1d23aa-6cb2-48cb-a47a-9cef29622676</trackback:ping>
      <pingback:server>http://www.sedodream.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.sedodream.com/PermaLink,guid,9b1d23aa-6cb2-48cb-a47a-9cef29622676.aspx</pingback:target>
      <dc:creator>sayed.hashimi@gmail.com (Sayed Ibrahim Hashimi)</dc:creator>
      <wfw:comment>http://www.sedodream.com/CommentView,guid,9b1d23aa-6cb2-48cb-a47a-9cef29622676.aspx</wfw:comment>
      <wfw:commentRss>http://www.sedodream.com/SyndicationService.asmx/GetEntryCommentsRss?guid=9b1d23aa-6cb2-48cb-a47a-9cef29622676</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
      After some discussion at the <a href="http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=3303182&amp;SiteID=1">MSBuild
      MSDN Forum</a> I started investigating building the same project with different Compiler
      constants defined. I was actually pretty surprised by what I found. I created a simple
      Windows Form Application with a lone button one it. The image below show the simple
      app. 
   </p>
        <p>
          <img src="http://www.sedodream.com/content/binary/050708_2358_MSBuildBuil1.png" alt="" />
        </p>
        <p>
      Here is the entire code behind file. 
   </p>
        <p>
          <span style="font-family:Consolas; font-size:10pt">using System; </span>
        </p>
        <p>
          <span style="font-family:Consolas; font-size:10pt">using System.Collections.Generic; </span>
        </p>
        <p>
          <span style="font-family:Consolas; font-size:10pt">using System.ComponentModel; </span>
        </p>
        <p>
          <span style="font-family:Consolas; font-size:10pt">using System.Data; </span>
        </p>
        <p>
          <span style="font-family:Consolas; font-size:10pt">using System.Drawing; </span>
        </p>
        <p>
          <span style="font-family:Consolas; font-size:10pt">using System.Linq; </span>
        </p>
        <p>
          <span style="font-family:Consolas; font-size:10pt">using System.Text; </span>
        </p>
        <p>
          <span style="font-family:Consolas; font-size:10pt">using System.Windows.Forms; </span>
        </p>
        <p>
        </p>
        <p>
          <span style="font-family:Consolas; font-size:10pt">namespace WindowsFormsApplication1 </span>
        </p>
        <p>
          <span style="font-family:Consolas; font-size:10pt">{ </span>
        </p>
        <p>
          <span style="font-family:Consolas; font-size:10pt"> public partial class Form1 : Form </span>
        </p>
        <p>
          <span style="font-family:Consolas; font-size:10pt"> { </span>
        </p>
        <p>
          <span style="font-family:Consolas; font-size:10pt"> public Form1() </span>
        </p>
        <p>
          <span style="font-family:Consolas; font-size:10pt"> { </span>
        </p>
        <p>
          <span style="font-family:Consolas; font-size:10pt"> InitializeComponent(); </span>
        </p>
        <p>
          <span style="font-family:Consolas; font-size:10pt"> } </span>
        </p>
        <p>
        </p>
        <p>
          <span style="font-family:Consolas; font-size:10pt"> private void buttonExample_Click(object
      sender, EventArgs e) </span>
        </p>
        <p>
          <span style="font-family:Consolas; font-size:10pt"> { </span>
        </p>
        <p>
          <span style="font-family:Consolas; font-size:10pt"> string message = "default message"; </span>
        </p>
        <p>
          <span style="font-family:Consolas; font-size:10pt">
            <span style="background-color:yellow">#if
      CONSTANT_ONE</span>
          </span>
        </p>
        <p>
          <span style="font-family:Consolas; font-size:10pt"> message = "CONSTANT_ONE"; </span>
        </p>
        <p>
          <span style="font-family:Consolas; font-size:10pt">#endif </span>
        </p>
        <p>
          <span style="font-family:Consolas; font-size:10pt">
            <span style="background-color:yellow">#if
      CONSTANT_TWO</span>
          </span>
        </p>
        <p>
          <span style="font-family:Consolas; font-size:10pt"> message = "CONSTANT_TWO"; </span>
        </p>
        <p>
          <span style="font-family:Consolas; font-size:10pt">#endif </span>
        </p>
        <p>
        </p>
        <p>
          <span style="font-family:Consolas; font-size:10pt"> MessageBox.Show(message); </span>
        </p>
        <p>
          <span style="font-family:Consolas; font-size:10pt"> } </span>
        </p>
        <p>
          <span style="font-family:Consolas; font-size:10pt"> } </span>
        </p>
        <p>
          <span style="font-family:Consolas; font-size:10pt">} </span>
        </p>
        <p>
      Ddd 
   </p>
        <p>
      The parts to take note are the regions highlighted in <span style="background-color:yellow">yellow</span>.
      So if the constant <em>CONSTANT_ONE</em> is defined the message results to CONSTANT_ONE
      and if CONSTANT_TWO is defined it will show the message <em>CONSTANT_TWO</em>. 
   </p>
        <p>
      I then created the simple build file. 
   </p>
        <p>
          <span style="font-family:Consolas; font-size:10pt">&lt;?xml version="1.0" encoding="utf-8"?&gt; </span>
        </p>
        <p>
          <span style="font-family:Consolas; font-size:10pt">&lt;Project DefaultTargets="BuildAll"
      ToolsVersion="3.5" </span>
        </p>
        <p>
          <span style="font-family:Consolas; font-size:10pt"> xmlns="http://schemas.microsoft.com/developer/msbuild/2003"&gt; </span>
        </p>
        <p>
        </p>
        <p>
          <span style="font-family:Consolas; font-size:10pt"> &lt;PropertyGroup&gt; </span>
        </p>
        <p>
          <span style="font-family:Consolas; font-size:10pt"> &lt;ConstOne&gt;CONSTANT_ONE&lt;/ConstOne&gt; </span>
        </p>
        <p>
          <span style="font-family:Consolas; font-size:10pt"> &lt;ConstTwo&gt;CONSTANT_TWO&lt;/ConstTwo&gt; </span>
        </p>
        <p>
          <span style="font-family:Consolas; font-size:10pt"> &lt;/PropertyGroup&gt; </span>
        </p>
        <p>
        </p>
        <p>
          <span style="font-family:Consolas; font-size:10pt"> &lt;ItemGroup&gt; </span>
        </p>
        <p>
          <span style="font-family:Consolas; font-size:10pt"> &lt;Projects Include="$(MSBuildProjectDirectory)\..\WindowsFormsApplication1\WindowsFormsApplication1.csproj"&gt; </span>
        </p>
        <p>
          <span style="font-family:Consolas; font-size:10pt"> &lt;/Projects&gt; </span>
        </p>
        <p>
          <span style="font-family:Consolas; font-size:10pt"> &lt;/ItemGroup&gt; </span>
        </p>
        <p>
        </p>
        <p>
          <span style="font-family:Consolas; font-size:10pt"> &lt;!-- </span>
        </p>
        <p>
          <span style="font-family:Consolas; font-size:10pt"> Cleans the project before we start
      the build process. </span>
        </p>
        <p>
          <span style="font-family:Consolas; font-size:10pt"> The only reason I am calling this
      is to remove artifacts of </span>
        </p>
        <p>
          <span style="font-family:Consolas; font-size:10pt"> previous builds, to clearly demonstrate
      what's going on. </span>
        </p>
        <p>
          <span style="font-family:Consolas; font-size:10pt"> --&gt; </span>
        </p>
        <p>
          <span style="font-family:Consolas; font-size:10pt"> &lt;Target Name="CleanAll"&gt; </span>
        </p>
        <p>
          <span style="font-family:Consolas; font-size:10pt"> &lt;MSBuild Projects="@(Projects)"
      Targets="Clean" /&gt; </span>
        </p>
        <p>
          <span style="font-family:Consolas; font-size:10pt"> &lt;/Target&gt; </span>
        </p>
        <p>
        </p>
        <p>
          <span style="font-family:Consolas; font-size:10pt"> &lt;Target Name="BuildAll" DependsOnTargets="CleanAll;BuildConstOne;BuildConstTwo"
      /&gt; </span>
        </p>
        <p>
        </p>
        <p>
          <span style="font-family:Consolas; font-size:10pt"> &lt;Target Name="BuildConstOne"&gt; </span>
        </p>
        <p>
          <span style="font-family:Consolas; font-size:10pt"> &lt;MSBuild Projects="@(Projects)" </span>
        </p>
        <p>
          <span style="font-family:Consolas; font-size:10pt"> Properties="DefineConstants=$(ConstOne);OutputPath=binOne\;"/&gt; </span>
        </p>
        <p>
          <span style="font-family:Consolas; font-size:10pt"> &lt;/Target&gt; </span>
        </p>
        <p>
          <span style="font-family:Consolas; font-size:10pt"> &lt;Target Name="BuildConstTwo"&gt; </span>
        </p>
        <p>
          <span style="font-family:Consolas; font-size:10pt"> &lt;MSBuild Projects="@(Projects)" </span>
        </p>
        <p>
          <span style="font-family:Consolas; font-size:10pt"> Properties="DefineConstants=$(ConstTwo);OutputPath=binTwo\;" </span>
        </p>
        <p>
        </p>
        <p>
          <span style="font-family:Consolas; font-size:10pt"> /&gt; </span>
        </p>
        <p>
          <span style="font-family:Consolas; font-size:10pt"> &lt;/Target&gt; </span>
        </p>
        <p>
        </p>
        <p>
          <span style="font-family:Consolas; font-size:10pt"> &lt;!-- =========================================================================== </span>
        </p>
        <p>
          <span style="font-family:Consolas; font-size:10pt"> This region rebuilds the projects,
      so after it is built once it is then cleaned </span>
        </p>
        <p>
          <span style="font-family:Consolas; font-size:10pt"> before building it again. </span>
        </p>
        <p>
          <span style="font-family:Consolas; font-size:10pt"> This produces the assemblies with
      the desired behavior </span>
        </p>
        <p>
          <span style="font-family:Consolas; font-size:10pt"> ================================================================================--&gt; </span>
        </p>
        <p>
        </p>
        <p>
          <span style="font-family:Consolas; font-size:10pt"> &lt;Target Name="ReBuildAll" DependsOnTargets="CleanAll;ReBuildConstOne;ReBuildConstTwo"
      /&gt; </span>
        </p>
        <p>
          <span style="font-family:Consolas; font-size:10pt"> &lt;Target Name="ReBuildConstOne"&gt; </span>
        </p>
        <p>
          <span style="font-family:Consolas; font-size:10pt"> &lt;MSBuild Projects="@(Projects)"
      Targets="Rebuild" </span>
        </p>
        <p>
          <span style="font-family:Consolas; font-size:10pt"> Properties="DefineConstants=$(ConstOne);OutputPath=binOne\;"/&gt; </span>
        </p>
        <p>
          <span style="font-family:Consolas; font-size:10pt"> &lt;/Target&gt; </span>
        </p>
        <p>
          <span style="font-family:Consolas; font-size:10pt"> &lt;Target Name="ReBuildConstTwo"&gt; </span>
        </p>
        <p>
          <span style="font-family:Consolas; font-size:10pt"> &lt;MSBuild Projects="@(Projects)"
      Targets="Rebuild" </span>
        </p>
        <p>
          <span style="font-family:Consolas; font-size:10pt"> Properties="DefineConstants=$(ConstTwo);OutputPath=binTwo\;"/&gt; </span>
        </p>
        <p>
          <span style="font-family:Consolas; font-size:10pt"> &lt;/Target&gt; </span>
        </p>
        <p>
        </p>
        <p>
          <span style="font-family:Consolas; font-size:10pt"> &lt;!--========================================================================== </span>
        </p>
        <p>
          <span style="font-family:Consolas; font-size:10pt"> This region calls the default
      target (Build) but also specifies the </span>
        </p>
        <p>
          <span style="font-family:Consolas; font-size:10pt"> BaseIntermediateOutputPath so
      it works as well because the projects </span>
        </p>
        <p>
          <span style="font-family:Consolas; font-size:10pt"> are building to different locations
      on disk. </span>
        </p>
        <p>
          <span style="font-family:Consolas; font-size:10pt"> ==============================================================================--&gt; </span>
        </p>
        <p>
          <span style="font-family:Consolas; font-size:10pt"> &lt;Target Name="BuildAllBetter"
      DependsOnTargets="CleanAll;BuildConstOneBetter;BuildConstTwoBetter" /&gt; </span>
        </p>
        <p>
          <span style="font-family:Consolas; font-size:10pt"> &lt;Target Name="BuildConstOneBetter"&gt; </span>
        </p>
        <p>
          <span style="font-family:Consolas; font-size:10pt"> &lt;MSBuild Projects="@(Projects)" </span>
        </p>
        <p>
          <span style="font-family:Consolas; font-size:10pt"> Properties="DefineConstants=$(ConstOne);OutputPath=binOne\BaseIntermediateOutputPath=objOne\"/&gt; </span>
        </p>
        <p>
          <span style="font-family:Consolas; font-size:10pt"> &lt;/Target&gt; </span>
        </p>
        <p>
          <span style="font-family:Consolas; font-size:10pt"> &lt;Target Name="BuildConstTwoBetter"&gt; </span>
        </p>
        <p>
          <span style="font-family:Consolas; font-size:10pt"> &lt;MSBuild Projects="@(Projects)" </span>
        </p>
        <p>
          <span style="font-family:Consolas; font-size:10pt"> Properties="DefineConstants=$(ConstTwo);OutputPath=binTwo\;BaseIntermediateOutputPath=objTwo\;" </span>
        </p>
        <p>
        </p>
        <p>
          <span style="font-family:Consolas; font-size:10pt"> /&gt; </span>
        </p>
        <p>
          <span style="font-family:Consolas; font-size:10pt"> &lt;/Target&gt; </span>
        </p>
        <p>
        </p>
        <p>
          <span style="font-family:Consolas; font-size:10pt">&lt;/Project&gt; </span>
        </p>
        <p>
      Ddddd 
   </p>
        <p>
      Let's take a look at what's going on here. The <em>BuildConstOne</em> target passes
      the <em>CONSTANT_ONE</em> value as a property when invoking the <a href="http://msdn.microsoft.com/en-us/library/7z253716.aspx">MSBuild</a> task,
      and builds to the <em>binOne</em> folder. The <em>BuildConstTwo</em> target passes
      the <em>CONSTANT_TWO</em> value and builds to <em>binTwo</em>. If you execute the
      target <em>BuildAll</em>, you would expect that the exe in <em>binOne</em> would show
      the message <em>CONSTANT_ONE</em> and the exe in the <em>binTwo</em> folder has CONSTANT_TWO
      message showing. What you actually get is that both actually show <em>CONSTANT_ONE</em>.
      This is because MSBuild doesn't entirely rebuild the project when building it for
      the second time in BuildConstTwo. The real reason behind this would be because both
      projects are building to the same <em>BaseIntermediateOutputPath</em>, obj\. There
      are two ways to of getting around this, one is to call Rebuild instead of <em>Build</em>,
      and the other is to specify the <em>BaseIntermediateOutputPath</em> as well. In the
      above I have demonstrated both approaches. The ReBuildAll calls Rebuild, and the BuildAllBetter
      specifies the <em>BaseIntermediateOutputPath</em> as well as OutputPath. 
   </p>
        <p>
      Questions?! 
   </p>
        <p>
      You can download all the files at: 
   </p>
        <p>
          <a href="http://www.sedodream.com/content/binary/DefineConst.zip">DefineConst.zip</a>
        </p>
        <p>
      Sayed Ibrahim Hashimi 
   </p>
        <img width="0" height="0" src="http://www.sedodream.com/aggbug.ashx?id=9b1d23aa-6cb2-48cb-a47a-9cef29622676" />
      </body>
      <title>MSBuild: Building the same project multiple times</title>
      <guid>http://www.sedodream.com/PermaLink,guid,9b1d23aa-6cb2-48cb-a47a-9cef29622676.aspx</guid>
      <link>http://www.sedodream.com/PermaLink,guid,9b1d23aa-6cb2-48cb-a47a-9cef29622676.aspx</link>
      <pubDate>Wed, 07 May 2008 23:52:14 GMT</pubDate>
      <description>&lt;p&gt;
   After some discussion at the &lt;a href="http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=3303182&amp;amp;SiteID=1"&gt;MSBuild
   MSDN Forum&lt;/a&gt; I started investigating building the same project with different Compiler
   constants defined. I was actually pretty surprised by what I found. I created a simple
   Windows Form Application with a lone button one it. The image below show the simple
   app. 
&lt;/p&gt;
&lt;p&gt;
   &lt;img src="http://www.sedodream.com/content/binary/050708_2358_MSBuildBuil1.png" alt="" /&gt; 
&lt;/p&gt;
&lt;p&gt;
   Here is the entire code behind file. 
&lt;/p&gt;
&lt;p&gt;
   &lt;span style="font-family:Consolas; font-size:10pt"&gt;using System; &lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
   &lt;span style="font-family:Consolas; font-size:10pt"&gt;using System.Collections.Generic; &lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
   &lt;span style="font-family:Consolas; font-size:10pt"&gt;using System.ComponentModel; &lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
   &lt;span style="font-family:Consolas; font-size:10pt"&gt;using System.Data; &lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
   &lt;span style="font-family:Consolas; font-size:10pt"&gt;using System.Drawing; &lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
   &lt;span style="font-family:Consolas; font-size:10pt"&gt;using System.Linq; &lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
   &lt;span style="font-family:Consolas; font-size:10pt"&gt;using System.Text; &lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
   &lt;span style="font-family:Consolas; font-size:10pt"&gt;using System.Windows.Forms; &lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
   &lt;span style="font-family:Consolas; font-size:10pt"&gt;namespace WindowsFormsApplication1 &lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
   &lt;span style="font-family:Consolas; font-size:10pt"&gt;{ &lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
   &lt;span style="font-family:Consolas; font-size:10pt"&gt; public partial class Form1 : Form &lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
   &lt;span style="font-family:Consolas; font-size:10pt"&gt; { &lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
   &lt;span style="font-family:Consolas; font-size:10pt"&gt; public Form1() &lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
   &lt;span style="font-family:Consolas; font-size:10pt"&gt; { &lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
   &lt;span style="font-family:Consolas; font-size:10pt"&gt; InitializeComponent(); &lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
   &lt;span style="font-family:Consolas; font-size:10pt"&gt; } &lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
   &lt;span style="font-family:Consolas; font-size:10pt"&gt; private void buttonExample_Click(object
   sender, EventArgs e) &lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
   &lt;span style="font-family:Consolas; font-size:10pt"&gt; { &lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
   &lt;span style="font-family:Consolas; font-size:10pt"&gt; string message = "default message"; &lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
   &lt;span style="font-family:Consolas; font-size:10pt"&gt;&lt;span style="background-color:yellow"&gt;#if
   CONSTANT_ONE&lt;/span&gt; &lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
   &lt;span style="font-family:Consolas; font-size:10pt"&gt; message = "CONSTANT_ONE"; &lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
   &lt;span style="font-family:Consolas; font-size:10pt"&gt;#endif &lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
   &lt;span style="font-family:Consolas; font-size:10pt"&gt;&lt;span style="background-color:yellow"&gt;#if
   CONSTANT_TWO&lt;/span&gt; &lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
   &lt;span style="font-family:Consolas; font-size:10pt"&gt; message = "CONSTANT_TWO"; &lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
   &lt;span style="font-family:Consolas; font-size:10pt"&gt;#endif &lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
   &lt;span style="font-family:Consolas; font-size:10pt"&gt; MessageBox.Show(message); &lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
   &lt;span style="font-family:Consolas; font-size:10pt"&gt; } &lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
   &lt;span style="font-family:Consolas; font-size:10pt"&gt; } &lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
   &lt;span style="font-family:Consolas; font-size:10pt"&gt;} &lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
   Ddd 
&lt;/p&gt;
&lt;p&gt;
   The parts to take note are the regions highlighted in &lt;span style="background-color:yellow"&gt;yellow&lt;/span&gt;.
   So if the constant &lt;em&gt;CONSTANT_ONE&lt;/em&gt; is defined the message results to CONSTANT_ONE
   and if CONSTANT_TWO is defined it will show the message &lt;em&gt;CONSTANT_TWO&lt;/em&gt;. 
&lt;/p&gt;
&lt;p&gt;
   I then created the simple build file. 
&lt;/p&gt;
&lt;p&gt;
   &lt;span style="font-family:Consolas; font-size:10pt"&gt;&amp;lt;?xml version="1.0" encoding="utf-8"?&amp;gt; &lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
   &lt;span style="font-family:Consolas; font-size:10pt"&gt;&amp;lt;Project DefaultTargets="BuildAll"
   ToolsVersion="3.5" &lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
   &lt;span style="font-family:Consolas; font-size:10pt"&gt; xmlns="http://schemas.microsoft.com/developer/msbuild/2003"&amp;gt; &lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
   &lt;span style="font-family:Consolas; font-size:10pt"&gt; &amp;lt;PropertyGroup&amp;gt; &lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
   &lt;span style="font-family:Consolas; font-size:10pt"&gt; &amp;lt;ConstOne&amp;gt;CONSTANT_ONE&amp;lt;/ConstOne&amp;gt; &lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
   &lt;span style="font-family:Consolas; font-size:10pt"&gt; &amp;lt;ConstTwo&amp;gt;CONSTANT_TWO&amp;lt;/ConstTwo&amp;gt; &lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
   &lt;span style="font-family:Consolas; font-size:10pt"&gt; &amp;lt;/PropertyGroup&amp;gt; &lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
   &lt;span style="font-family:Consolas; font-size:10pt"&gt; &amp;lt;ItemGroup&amp;gt; &lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
   &lt;span style="font-family:Consolas; font-size:10pt"&gt; &amp;lt;Projects Include="$(MSBuildProjectDirectory)\..\WindowsFormsApplication1\WindowsFormsApplication1.csproj"&amp;gt; &lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
   &lt;span style="font-family:Consolas; font-size:10pt"&gt; &amp;lt;/Projects&amp;gt; &lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
   &lt;span style="font-family:Consolas; font-size:10pt"&gt; &amp;lt;/ItemGroup&amp;gt; &lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
   &lt;span style="font-family:Consolas; font-size:10pt"&gt; &amp;lt;!-- &lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
   &lt;span style="font-family:Consolas; font-size:10pt"&gt; Cleans the project before we start
   the build process. &lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
   &lt;span style="font-family:Consolas; font-size:10pt"&gt; The only reason I am calling this
   is to remove artifacts of &lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
   &lt;span style="font-family:Consolas; font-size:10pt"&gt; previous builds, to clearly demonstrate
   what's going on. &lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
   &lt;span style="font-family:Consolas; font-size:10pt"&gt; --&amp;gt; &lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
   &lt;span style="font-family:Consolas; font-size:10pt"&gt; &amp;lt;Target Name="CleanAll"&amp;gt; &lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
   &lt;span style="font-family:Consolas; font-size:10pt"&gt; &amp;lt;MSBuild Projects="@(Projects)"
   Targets="Clean" /&amp;gt; &lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
   &lt;span style="font-family:Consolas; font-size:10pt"&gt; &amp;lt;/Target&amp;gt; &lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
   &lt;span style="font-family:Consolas; font-size:10pt"&gt; &amp;lt;Target Name="BuildAll" DependsOnTargets="CleanAll;BuildConstOne;BuildConstTwo"
   /&amp;gt; &lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
   &lt;span style="font-family:Consolas; font-size:10pt"&gt; &amp;lt;Target Name="BuildConstOne"&amp;gt; &lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
   &lt;span style="font-family:Consolas; font-size:10pt"&gt; &amp;lt;MSBuild Projects="@(Projects)" &lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
   &lt;span style="font-family:Consolas; font-size:10pt"&gt; Properties="DefineConstants=$(ConstOne);OutputPath=binOne\;"/&amp;gt; &lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
   &lt;span style="font-family:Consolas; font-size:10pt"&gt; &amp;lt;/Target&amp;gt; &lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
   &lt;span style="font-family:Consolas; font-size:10pt"&gt; &amp;lt;Target Name="BuildConstTwo"&amp;gt; &lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
   &lt;span style="font-family:Consolas; font-size:10pt"&gt; &amp;lt;MSBuild Projects="@(Projects)" &lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
   &lt;span style="font-family:Consolas; font-size:10pt"&gt; Properties="DefineConstants=$(ConstTwo);OutputPath=binTwo\;" &lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
   &lt;span style="font-family:Consolas; font-size:10pt"&gt; /&amp;gt; &lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
   &lt;span style="font-family:Consolas; font-size:10pt"&gt; &amp;lt;/Target&amp;gt; &lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
   &lt;span style="font-family:Consolas; font-size:10pt"&gt; &amp;lt;!-- =========================================================================== &lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
   &lt;span style="font-family:Consolas; font-size:10pt"&gt; This region rebuilds the projects,
   so after it is built once it is then cleaned &lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
   &lt;span style="font-family:Consolas; font-size:10pt"&gt; before building it again. &lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
   &lt;span style="font-family:Consolas; font-size:10pt"&gt; This produces the assemblies with
   the desired behavior &lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
   &lt;span style="font-family:Consolas; font-size:10pt"&gt; ================================================================================--&amp;gt; &lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
   &lt;span style="font-family:Consolas; font-size:10pt"&gt; &amp;lt;Target Name="ReBuildAll" DependsOnTargets="CleanAll;ReBuildConstOne;ReBuildConstTwo"
   /&amp;gt; &lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
   &lt;span style="font-family:Consolas; font-size:10pt"&gt; &amp;lt;Target Name="ReBuildConstOne"&amp;gt; &lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
   &lt;span style="font-family:Consolas; font-size:10pt"&gt; &amp;lt;MSBuild Projects="@(Projects)"
   Targets="Rebuild" &lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
   &lt;span style="font-family:Consolas; font-size:10pt"&gt; Properties="DefineConstants=$(ConstOne);OutputPath=binOne\;"/&amp;gt; &lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
   &lt;span style="font-family:Consolas; font-size:10pt"&gt; &amp;lt;/Target&amp;gt; &lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
   &lt;span style="font-family:Consolas; font-size:10pt"&gt; &amp;lt;Target Name="ReBuildConstTwo"&amp;gt; &lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
   &lt;span style="font-family:Consolas; font-size:10pt"&gt; &amp;lt;MSBuild Projects="@(Projects)"
   Targets="Rebuild" &lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
   &lt;span style="font-family:Consolas; font-size:10pt"&gt; Properties="DefineConstants=$(ConstTwo);OutputPath=binTwo\;"/&amp;gt; &lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
   &lt;span style="font-family:Consolas; font-size:10pt"&gt; &amp;lt;/Target&amp;gt; &lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
   &lt;span style="font-family:Consolas; font-size:10pt"&gt; &amp;lt;!--========================================================================== &lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
   &lt;span style="font-family:Consolas; font-size:10pt"&gt; This region calls the default
   target (Build) but also specifies the &lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
   &lt;span style="font-family:Consolas; font-size:10pt"&gt; BaseIntermediateOutputPath so
   it works as well because the projects &lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
   &lt;span style="font-family:Consolas; font-size:10pt"&gt; are building to different locations
   on disk. &lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
   &lt;span style="font-family:Consolas; font-size:10pt"&gt; ==============================================================================--&amp;gt; &lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
   &lt;span style="font-family:Consolas; font-size:10pt"&gt; &amp;lt;Target Name="BuildAllBetter"
   DependsOnTargets="CleanAll;BuildConstOneBetter;BuildConstTwoBetter" /&amp;gt; &lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
   &lt;span style="font-family:Consolas; font-size:10pt"&gt; &amp;lt;Target Name="BuildConstOneBetter"&amp;gt; &lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
   &lt;span style="font-family:Consolas; font-size:10pt"&gt; &amp;lt;MSBuild Projects="@(Projects)" &lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
   &lt;span style="font-family:Consolas; font-size:10pt"&gt; Properties="DefineConstants=$(ConstOne);OutputPath=binOne\BaseIntermediateOutputPath=objOne\"/&amp;gt; &lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
   &lt;span style="font-family:Consolas; font-size:10pt"&gt; &amp;lt;/Target&amp;gt; &lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
   &lt;span style="font-family:Consolas; font-size:10pt"&gt; &amp;lt;Target Name="BuildConstTwoBetter"&amp;gt; &lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
   &lt;span style="font-family:Consolas; font-size:10pt"&gt; &amp;lt;MSBuild Projects="@(Projects)" &lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
   &lt;span style="font-family:Consolas; font-size:10pt"&gt; Properties="DefineConstants=$(ConstTwo);OutputPath=binTwo\;BaseIntermediateOutputPath=objTwo\;" &lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
   &lt;span style="font-family:Consolas; font-size:10pt"&gt; /&amp;gt; &lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
   &lt;span style="font-family:Consolas; font-size:10pt"&gt; &amp;lt;/Target&amp;gt; &lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
   &lt;span style="font-family:Consolas; font-size:10pt"&gt;&amp;lt;/Project&amp;gt; &lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
   Ddddd 
&lt;/p&gt;
&lt;p&gt;
   Let's take a look at what's going on here. The &lt;em&gt;BuildConstOne&lt;/em&gt; target passes
   the &lt;em&gt;CONSTANT_ONE&lt;/em&gt; value as a property when invoking the &lt;a href="http://msdn.microsoft.com/en-us/library/7z253716.aspx"&gt;MSBuild&lt;/a&gt; task,
   and builds to the &lt;em&gt;binOne&lt;/em&gt; folder. The &lt;em&gt;BuildConstTwo&lt;/em&gt; target passes
   the &lt;em&gt;CONSTANT_TWO&lt;/em&gt; value and builds to &lt;em&gt;binTwo&lt;/em&gt;. If you execute the
   target &lt;em&gt;BuildAll&lt;/em&gt;, you would expect that the exe in &lt;em&gt;binOne&lt;/em&gt; would show
   the message &lt;em&gt;CONSTANT_ONE&lt;/em&gt; and the exe in the &lt;em&gt;binTwo&lt;/em&gt; folder has CONSTANT_TWO
   message showing. What you actually get is that both actually show &lt;em&gt;CONSTANT_ONE&lt;/em&gt;.
   This is because MSBuild doesn't entirely rebuild the project when building it for
   the second time in BuildConstTwo. The real reason behind this would be because both
   projects are building to the same &lt;em&gt;BaseIntermediateOutputPath&lt;/em&gt;, obj\. There
   are two ways to of getting around this, one is to call Rebuild instead of &lt;em&gt;Build&lt;/em&gt;,
   and the other is to specify the &lt;em&gt;BaseIntermediateOutputPath&lt;/em&gt; as well. In the
   above I have demonstrated both approaches. The ReBuildAll calls Rebuild, and the BuildAllBetter
   specifies the &lt;em&gt;BaseIntermediateOutputPath&lt;/em&gt; as well as OutputPath. 
&lt;/p&gt;
&lt;p&gt;
   Questions?! 
&lt;/p&gt;
&lt;p&gt;
   You can download all the files at: 
&lt;/p&gt;
&lt;p&gt;
   &lt;a href="http://www.sedodream.com/content/binary/DefineConst.zip"&gt;DefineConst.zip&lt;/a&gt; 
&lt;/p&gt;
&lt;p&gt;
   Sayed Ibrahim Hashimi 
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.sedodream.com/aggbug.ashx?id=9b1d23aa-6cb2-48cb-a47a-9cef29622676" /&gt;</description>
      <comments>http://www.sedodream.com/CommentView,guid,9b1d23aa-6cb2-48cb-a47a-9cef29622676.aspx</comments>
      <category>MSBuild;Visual Studio</category>
    </item>
    <item>
      <trackback:ping>http://www.sedodream.com/Trackback.aspx?guid=29c564ee-05ed-47e3-b2bb-fe6b05b623c6</trackback:ping>
      <pingback:server>http://www.sedodream.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.sedodream.com/PermaLink,guid,29c564ee-05ed-47e3-b2bb-fe6b05b623c6.aspx</pingback:target>
      <dc:creator>sayed.hashimi@gmail.com (Sayed Ibrahim Hashimi)</dc:creator>
      <wfw:comment>http://www.sedodream.com/CommentView,guid,29c564ee-05ed-47e3-b2bb-fe6b05b623c6.aspx</wfw:comment>
      <wfw:commentRss>http://www.sedodream.com/SyndicationService.asmx/GetEntryCommentsRss?guid=29c564ee-05ed-47e3-b2bb-fe6b05b623c6</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
      A question that comes up pretty frequently is <em>"How can I debug an MSBuild task"</em>?
      It's actually pretty simple. In this post I will describe how to easily an effectively
      debug MSBuild tasks that you are creating. In this example I will be demonstrating
      a task from my open source tasks at <a href="http://www.codeplex.com/Sedodream">www.codeplex.com/Sedodream</a>.
      The task is one that was contributed by <a href="http://ozgrant.com/2008/04/04/createguid-msbuild-task/">Grant
      Holliday</a>. 
   </p>
        <p>
      First in the project where your tasks are contained create a folder that will be used
      to contain sample MSBuid files that can be used to debug the tasks. This is also a
      good idea, because it will show people how to use your tasks. If you are don't want
      to mix samples &amp; code in the same project then just make sure in your build you
      copy the files to the correct locations. In the sample project, which you can download
      at the bottom, the folder is named <strong>Samples</strong>. When you add MSBuild
      files to the folder make sure you set the file to be copied to the output folder as
      well. See the image below. 
   </p>
        <p>
          <img src="http://www.sedodream.com/content/binary/042908_0515_HowtodebugM1.png" alt="" />
        </p>
        <p>
      By setting this, the file will be copied to the output folder when the project is
      built. Since it will be in the output folder we can use a relative path to get to
      the assembly that contains the task. Take a look at the sample MSBuild file for this
      task. 
   </p>
        <p>
          <span style="color: rgb(0, 176, 80);">&lt;?xml version="1.0" encoding="utf-8"?&gt; </span>
        </p>
        <p>
          <span style="color: rgb(0, 176, 80);">&lt;Project ToolsVersion="3.5" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"&gt; </span>
        </p>
        <p>
          <span style="color: rgb(0, 176, 80);">   &lt;PropertyGroup&gt; </span>
        </p>
        <p>
          <span style="color: rgb(0, 176, 80);">    <span style="background-color: yellow;">&lt;TaskLocation
      Condition="$(TaskLocation)==''"&gt;$(MSBuildProjectDirectory)\..\DebugTask.dll&lt;/TaskLocation&gt;</span></span>
        </p>
        <p>
          <span style="color: rgb(0, 176, 80);">  &lt;/PropertyGroup&gt; </span>
        </p>
        <p>
          <span style="color: rgb(0, 176, 80);">   &lt;UsingTask TaskName="CreateGuid"
      AssemblyFile="$(TaskLocation)"/&gt; </span>
        </p>
        <p>
       
   </p>
        <p>
          <span style="color: rgb(0, 176, 80);">  &lt;Target Name="Example"&gt; </span>
        </p>
        <p>
          <span style="color: rgb(0, 176, 80);">    &lt;Message Text="Starting example"
      /&gt; </span>
        </p>
        <p>
          <span style="color: rgb(0, 176, 80);">    &lt;CreateGuid&gt; </span>
        </p>
        <p>
          <span style="color: rgb(0, 176, 80);">        &lt;Output
      PropertyName="Guid" TaskParameter="Output"/&gt; </span>
        </p>
        <p>
          <span style="color: rgb(0, 176, 80);">      &lt;/CreateGuid&gt; </span>
        </p>
        <p>
          <span style="color: rgb(0, 176, 80);">    &lt;Message Text="Guid: $(Guid)"
      /&gt; </span>
        </p>
        <p>
          <span style="color: rgb(0, 176, 80);">   &lt;/Target&gt; </span>
        </p>
        <p>
          <span style="color: rgb(0, 176, 80);">&lt;/Project&gt; </span>
        </p>
        <p>
       
   </p>
        <p>
      The line highlighted contains the path to the assembly that contains the task. This
      path is relative to the location in the output folder, not the source folder. Also
      another thing to take note, is that we only write to the <span style="color: rgb(0, 176, 80);"><em>TaskLocation</em></span> property
      if it is empty. This is useful because you can overwrite the location through command
      line parameters if necessary. But this shouldn't be needed for what we are trying
      to accomplish here. 
   </p>
        <p>
      After you create the sample, build the solution. And open a command prompt to verify
      that it works. Here is a sample of the result of this project file. 
   </p>
        <p>
          <img src="http://www.sedodream.com/content/binary/042908_0515_HowtodebugM2.png" alt="" />
        </p>
        <p>
      Once you've verified that that MSBuild file works then you can right click on the
      project that contains your task, and select properties. From there go to the debug
      tab. What we want to do is start the msbuild.exe executable on that sample project
      file. To do this fill in the full path to it in the Start External program text box,
      i.e. '<em>C:\WINDOWS\Microsoft.NET\Framework\v3.5\MSBuild.exe</em>'. In the command
      line arguments you should pass the name of the project file followed by any msbuild
      parameters. Typically I will attach a file logger to the process. Finally you should
      set the working directory to the folder containing the sample. The result should look
      something like the image shown below. 
   </p>
        <p>
          <img src="http://www.sedodream.com/content/binary/042908_0515_HowtodebugM3.png" alt="" />
        </p>
        <p>
      Following this set a break point in your task, set the project as the startup project
      and hit F5! Another thing to take note of is that these properties are stored in the <em>.user</em> file
      so it shouldn't affect any other developers on your team. 
   </p>
        <p>
      Below is the link containing a simple solution that was used here. 
   </p>
        <p>
       
   </p>
        <p>
          <a href="http://www.sedodream.com/content/binary/DebugTask.zip">DebugTask.zip</a>
        </p>
        <p>
      Sayed Ibrahim Hashimi
   </p>
        <img width="0" height="0" src="http://www.sedodream.com/aggbug.ashx?id=29c564ee-05ed-47e3-b2bb-fe6b05b623c6" />
      </body>
      <title>How to debug MSBuild tasks</title>
      <guid>http://www.sedodream.com/PermaLink,guid,29c564ee-05ed-47e3-b2bb-fe6b05b623c6.aspx</guid>
      <link>http://www.sedodream.com/PermaLink,guid,29c564ee-05ed-47e3-b2bb-fe6b05b623c6.aspx</link>
      <pubDate>Tue, 29 Apr 2008 05:10:03 GMT</pubDate>
      <description>&lt;p&gt;
   A question that comes up pretty frequently is &lt;em&gt;"How can I debug an MSBuild task"&lt;/em&gt;?
   It's actually pretty simple. In this post I will describe how to easily an effectively
   debug MSBuild tasks that you are creating. In this example I will be demonstrating
   a task from my open source tasks at &lt;a href="http://www.codeplex.com/Sedodream"&gt;www.codeplex.com/Sedodream&lt;/a&gt;.
   The task is one that was contributed by &lt;a href="http://ozgrant.com/2008/04/04/createguid-msbuild-task/"&gt;Grant
   Holliday&lt;/a&gt;. 
&lt;/p&gt;
&lt;p&gt;
   First in the project where your tasks are contained create a folder that will be used
   to contain sample MSBuid files that can be used to debug the tasks. This is also a
   good idea, because it will show people how to use your tasks. If you are don't want
   to mix samples &amp;amp; code in the same project then just make sure in your build you
   copy the files to the correct locations. In the sample project, which you can download
   at the bottom, the folder is named &lt;strong&gt;Samples&lt;/strong&gt;. When you add MSBuild
   files to the folder make sure you set the file to be copied to the output folder as
   well. See the image below. 
&lt;/p&gt;
&lt;p&gt;
   &lt;img src="http://www.sedodream.com/content/binary/042908_0515_HowtodebugM1.png" alt=""&gt; 
&lt;/p&gt;
&lt;p&gt;
   By setting this, the file will be copied to the output folder when the project is
   built. Since it will be in the output folder we can use a relative path to get to
   the assembly that contains the task. Take a look at the sample MSBuild file for this
   task. 
&lt;/p&gt;
&lt;p&gt;
   &lt;span style="color: rgb(0, 176, 80);"&gt;&amp;lt;?xml version="1.0" encoding="utf-8"?&amp;gt; &lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
   &lt;span style="color: rgb(0, 176, 80);"&gt;&amp;lt;Project ToolsVersion="3.5" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"&amp;gt; &lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
   &lt;span style="color: rgb(0, 176, 80);"&gt;&amp;nbsp;&amp;nbsp; &amp;lt;PropertyGroup&amp;gt; &lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
   &lt;span style="color: rgb(0, 176, 80);"&gt;&amp;nbsp; &amp;nbsp; &lt;span style="background-color: yellow;"&gt;&amp;lt;TaskLocation
   Condition="$(TaskLocation)==''"&amp;gt;$(MSBuildProjectDirectory)\..\DebugTask.dll&amp;lt;/TaskLocation&amp;gt;&lt;/span&gt; &lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
   &lt;span style="color: rgb(0, 176, 80);"&gt;&amp;nbsp; &amp;lt;/PropertyGroup&amp;gt; &lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
   &lt;span style="color: rgb(0, 176, 80);"&gt;&amp;nbsp;&amp;nbsp; &amp;lt;UsingTask TaskName="CreateGuid"
   AssemblyFile="$(TaskLocation)"/&amp;gt; &lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
   &amp;nbsp;
&lt;/p&gt;
&lt;p&gt;
   &lt;span style="color: rgb(0, 176, 80);"&gt;&amp;nbsp; &amp;lt;Target Name="Example"&amp;gt; &lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
   &lt;span style="color: rgb(0, 176, 80);"&gt;&amp;nbsp; &amp;nbsp; &amp;lt;Message Text="Starting example"
   /&amp;gt; &lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
   &lt;span style="color: rgb(0, 176, 80);"&gt;&amp;nbsp; &amp;nbsp; &amp;lt;CreateGuid&amp;gt; &lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
   &lt;span style="color: rgb(0, 176, 80);"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;lt;Output
   PropertyName="Guid" TaskParameter="Output"/&amp;gt; &lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
   &lt;span style="color: rgb(0, 176, 80);"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;lt;/CreateGuid&amp;gt; &lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
   &lt;span style="color: rgb(0, 176, 80);"&gt;&amp;nbsp; &amp;nbsp; &amp;lt;Message Text="Guid: $(Guid)"
   /&amp;gt; &lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
   &lt;span style="color: rgb(0, 176, 80);"&gt;&amp;nbsp;&amp;nbsp; &amp;lt;/Target&amp;gt; &lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
   &lt;span style="color: rgb(0, 176, 80);"&gt;&amp;lt;/Project&amp;gt; &lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
   &amp;nbsp;
&lt;/p&gt;
&lt;p&gt;
   The line highlighted contains the path to the assembly that contains the task. This
   path is relative to the location in the output folder, not the source folder. Also
   another thing to take note, is that we only write to the &lt;span style="color: rgb(0, 176, 80);"&gt;&lt;em&gt;TaskLocation&lt;/em&gt;&lt;/span&gt; property
   if it is empty. This is useful because you can overwrite the location through command
   line parameters if necessary. But this shouldn't be needed for what we are trying
   to accomplish here. 
&lt;/p&gt;
&lt;p&gt;
   After you create the sample, build the solution. And open a command prompt to verify
   that it works. Here is a sample of the result of this project file. 
&lt;/p&gt;
&lt;p&gt;
   &lt;img src="http://www.sedodream.com/content/binary/042908_0515_HowtodebugM2.png" alt=""&gt; 
&lt;/p&gt;
&lt;p&gt;
   Once you've verified that that MSBuild file works then you can right click on the
   project that contains your task, and select properties. From there go to the debug
   tab. What we want to do is start the msbuild.exe executable on that sample project
   file. To do this fill in the full path to it in the Start External program text box,
   i.e. '&lt;em&gt;C:\WINDOWS\Microsoft.NET\Framework\v3.5\MSBuild.exe&lt;/em&gt;'. In the command
   line arguments you should pass the name of the project file followed by any msbuild
   parameters. Typically I will attach a file logger to the process. Finally you should
   set the working directory to the folder containing the sample. The result should look
   something like the image shown below. 
&lt;/p&gt;
&lt;p&gt;
   &lt;img src="http://www.sedodream.com/content/binary/042908_0515_HowtodebugM3.png" alt=""&gt; 
&lt;/p&gt;
&lt;p&gt;
   Following this set a break point in your task, set the project as the startup project
   and hit F5! Another thing to take note of is that these properties are stored in the &lt;em&gt;.user&lt;/em&gt; file
   so it shouldn't affect any other developers on your team. 
&lt;/p&gt;
&lt;p&gt;
   Below is the link containing a simple solution that was used here. 
&lt;/p&gt;
&lt;p&gt;
   &amp;nbsp;
&lt;/p&gt;
&lt;p&gt;
   &lt;a href="http://www.sedodream.com/content/binary/DebugTask.zip"&gt;DebugTask.zip&lt;/a&gt; 
&lt;/p&gt;
&lt;p&gt;
   Sayed Ibrahim Hashimi
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.sedodream.com/aggbug.ashx?id=29c564ee-05ed-47e3-b2bb-fe6b05b623c6" /&gt;</description>
      <comments>http://www.sedodream.com/CommentView,guid,29c564ee-05ed-47e3-b2bb-fe6b05b623c6.aspx</comments>
      <category>MSBuild;Visual Studio</category>
    </item>
    <item>
      <trackback:ping>http://www.sedodream.com/Trackback.aspx?guid=8e4c1e41-393b-402b-8251-10f3f59a54e2</trackback:ping>
      <pingback:server>http://www.sedodream.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.sedodream.com/PermaLink,guid,8e4c1e41-393b-402b-8251-10f3f59a54e2.aspx</pingback:target>
      <dc:creator>sayed.hashimi@gmail.com (Sayed Ibrahim Hashimi)</dc:creator>
      <wfw:comment>http://www.sedodream.com/CommentView,guid,8e4c1e41-393b-402b-8251-10f3f59a54e2.aspx</wfw:comment>
      <wfw:commentRss>http://www.sedodream.com/SyndicationService.asmx/GetEntryCommentsRss?guid=8e4c1e41-393b-402b-8251-10f3f59a54e2</wfw:commentRss>
      <slash:comments>4</slash:comments>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
      Recently I was introduced to a tool that was to a tool that would analyze Javascript
      for syntactical errors as well as usage of bad practices. This tool is <a href="http://www.jslint.com">JSLint</a>. <a href="http://www.crockford.com/">Douglas
      Crockford</a> from <a href="http://www.yahoo.com">Yahoo!</a> created, and maintains, <a href="http://www.jslint.com">JSLint</a>.
      If you haven't heard of him, he is a well known Javascript expert. 
   </p>
        <p>
      Now how can we verify our Javascript with JSLint &amp; MSBuild? In my open source
      project <a href="http://www.codeplex.com/sedodream">Sedodream MSBuild</a> I have created
      a new JSLint task. You can get the installer by going to <a href="http://www.codeplex.com/Release/ProjectReleases.aspx?ProjectName=Sedodream&amp;ReleaseId=12530">http://www.codeplex.com/Release/ProjectReleases.aspx?ProjectName=Sedodream&amp;ReleaseId=12530</a>.
      After you install the msi you can follow these steps to invoke the JSLint on your
      projects. 
   </p>
        <p>
      Edit your web project file and include the following snippet before the &lt;/Project&gt;
      tag. 
   </p>
        <p>
          <span style="font-family: Courier New; font-size: 10pt;">
            <span style="color: blue;"> &lt;</span>
            <span style="color: rgb(163, 21, 21);">Import</span>
            <span style="color: blue;">
            </span>
            <span style="color: red;">Project</span>
            <span style="color: blue;">=</span>"<span style="color: blue;">$(MSBuildExtensionsPath)\Sedodream\Sedodream.tasks</span>"<span style="color: blue;">/&gt; </span></span>
        </p>
        <p>
          <span style="font-family: Courier New; font-size: 10pt;">
            <span style="color: blue;"> &lt;</span>
            <span style="color: rgb(163, 21, 21);">Import</span>
            <span style="color: blue;">
            </span>
            <span style="color: red;">Project</span>
            <span style="color: blue;">=</span>"<span style="color: blue;">$(MSBuildExtensionsPath)\Sedodream\JSLint.targets</span>"<span style="color: blue;">/&gt; </span></span>
        </p>
        <p>
       
   </p>
        <p>
          <span style="font-family: Courier New; font-size: 10pt;">
            <span style="color: blue;"> &lt;</span>
            <span style="color: rgb(163, 21, 21);">PropertyGroup</span>
            <span style="color: blue;">&gt; </span>
          </span>
        </p>
        <p>
          <span style="font-family: Courier New; font-size: 10pt;">
            <span style="color: blue;"> &lt;</span>
            <span style="color: rgb(163, 21, 21);">BuildDependsOn</span>
            <span style="color: blue;">&gt; </span>
          </span>
        </p>
        <p>
          <span style="font-family: Courier New; font-size: 10pt;"> $(BuildDependsOn); </span>
        </p>
        <p>
          <span style="font-family: Courier New; font-size: 10pt;"> RunJSLint; </span>
        </p>
        <p>
          <span style="font-family: Courier New; font-size: 10pt;">
            <span style="color: blue;"> &lt;/</span>
            <span style="color: rgb(163, 21, 21);">BuildDependsOn</span>
            <span style="color: blue;">&gt; </span>
          </span>
        </p>
        <p>
          <span style="font-family: Courier New; font-size: 10pt;">
            <span style="color: blue;"> &lt;/</span>
            <span style="color: rgb(163, 21, 21);">PropertyGroup</span>
            <span style="color: blue;">&gt; </span>
          </span>
        </p>
        <p>
       
   </p>
        <p>
      The first line includes makes the tasks from my project available, and the second
      line includes the file that knows how to execute the JSLint tool. Following that I
      extend the build process to execute the <em>RunJSLint</em> target. If you are not
      familiar with this take a look at my article <a href="http://msdn2.microsoft.com/en-us/magazine/cc163589.aspx">Inside
      MSBuild</a>. 
   </p>
        <p>
      After you do this you may be prompted with a security warning from Visual Studio,
      you should pick 'Load Project Normally'. You can read more about how to disable it
      at <a href="http://msdn2.microsoft.com/en-us/library/ms228217.aspx">http://msdn2.microsoft.com/en-us/library/ms228217.aspx</a>.
      I chose to not have my installer set that registry flag. For the time being I think
      that users should make that decision themselves, although I would like to think I'm
      trustworthy <span style="font-family: Wingdings;">J</span></p>
        <p>
      After you do this and allow Visual Studio to load the project normally, if your create
      Javascript files that have errors, or JSLint doesn't like you will be warned in the
      error list as shown below. 
   </p>
        <p>
          <img src="http://www.sedodream.com/content/binary/041508_0531_MSBuildJSLi1.png" alt="" />
        </p>
        <p>
       
   </p>
        <p>
      With that being said keep in mind this is a<strong> V1</strong> deal, so this may
      not work perfect. I am working to make sure that it works well, but it was kinda tricky
      to get this to work period! 
   </p>
        <p>
      As always I welcome your feedback and I will post more info about this later. Oh yeah
      by default from <a href="http://www.jslint.com">JSLint</a> the GoodParts are enforced
      keep an eye on this blog, or send me a message, to see how to change that. 
   </p>
        <p>
      Sayed Ibrahim Hashimi
   </p>
        <img width="0" height="0" src="http://www.sedodream.com/aggbug.ashx?id=8e4c1e41-393b-402b-8251-10f3f59a54e2" />
      </body>
      <title>MSBuild + JSLint = Good Javascript</title>
      <guid>http://www.sedodream.com/PermaLink,guid,8e4c1e41-393b-402b-8251-10f3f59a54e2.aspx</guid>
      <link>http://www.sedodream.com/PermaLink,guid,8e4c1e41-393b-402b-8251-10f3f59a54e2.aspx</link>
      <pubDate>Tue, 15 Apr 2008 05:25:01 GMT</pubDate>
      <description>&lt;p&gt;
   Recently I was introduced to a tool that was to a tool that would analyze Javascript
   for syntactical errors as well as usage of bad practices. This tool is &lt;a href="http://www.jslint.com"&gt;JSLint&lt;/a&gt;. &lt;a href="http://www.crockford.com/"&gt;Douglas
   Crockford&lt;/a&gt; from &lt;a href="http://www.yahoo.com"&gt;Yahoo!&lt;/a&gt; created, and maintains, &lt;a href="http://www.jslint.com"&gt;JSLint&lt;/a&gt;.
   If you haven't heard of him, he is a well known Javascript expert. 
&lt;/p&gt;
&lt;p&gt;
   Now how can we verify our Javascript with JSLint &amp;amp; MSBuild? In my open source
   project &lt;a href="http://www.codeplex.com/sedodream"&gt;Sedodream MSBuild&lt;/a&gt; I have created
   a new JSLint task. You can get the installer by going to &lt;a href="http://www.codeplex.com/Release/ProjectReleases.aspx?ProjectName=Sedodream&amp;amp;ReleaseId=12530"&gt;http://www.codeplex.com/Release/ProjectReleases.aspx?ProjectName=Sedodream&amp;amp;ReleaseId=12530&lt;/a&gt;.
   After you install the msi you can follow these steps to invoke the JSLint on your
   projects. 
&lt;/p&gt;
&lt;p&gt;
   Edit your web project file and include the following snippet before the &amp;lt;/Project&amp;gt;
   tag. 
&lt;/p&gt;
&lt;p&gt;
   &lt;span style="font-family: Courier New; font-size: 10pt;"&gt;&lt;span style="color: blue;"&gt; &amp;lt;&lt;/span&gt;&lt;span style="color: rgb(163, 21, 21);"&gt;Import&lt;/span&gt;&lt;span style="color: blue;"&gt; &lt;/span&gt;&lt;span style="color: red;"&gt;Project&lt;/span&gt;&lt;span style="color: blue;"&gt;=&lt;/span&gt;"&lt;span style="color: blue;"&gt;$(MSBuildExtensionsPath)\Sedodream\Sedodream.tasks&lt;/span&gt;"&lt;span style="color: blue;"&gt;/&amp;gt; &lt;/span&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
   &lt;span style="font-family: Courier New; font-size: 10pt;"&gt;&lt;span style="color: blue;"&gt; &amp;lt;&lt;/span&gt;&lt;span style="color: rgb(163, 21, 21);"&gt;Import&lt;/span&gt;&lt;span style="color: blue;"&gt; &lt;/span&gt;&lt;span style="color: red;"&gt;Project&lt;/span&gt;&lt;span style="color: blue;"&gt;=&lt;/span&gt;"&lt;span style="color: blue;"&gt;$(MSBuildExtensionsPath)\Sedodream\JSLint.targets&lt;/span&gt;"&lt;span style="color: blue;"&gt;/&amp;gt; &lt;/span&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
   &amp;nbsp;
&lt;/p&gt;
&lt;p&gt;
   &lt;span style="font-family: Courier New; font-size: 10pt;"&gt;&lt;span style="color: blue;"&gt; &amp;lt;&lt;/span&gt;&lt;span style="color: rgb(163, 21, 21);"&gt;PropertyGroup&lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;gt; &lt;/span&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
   &lt;span style="font-family: Courier New; font-size: 10pt;"&gt;&lt;span style="color: blue;"&gt; &amp;lt;&lt;/span&gt;&lt;span style="color: rgb(163, 21, 21);"&gt;BuildDependsOn&lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;gt; &lt;/span&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
   &lt;span style="font-family: Courier New; font-si