<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <!-- This inline task executes c# code. -->
  <!-- C:\Windows\Microsoft.NET\Framework\v4.0.30319\msbuild.exe SimpleTasks.csproj -->
  <!-- Save This File And Execute The Above Command -->
   <!-- Author: Casey Smith, Twitter: @subTee -->
  <!-- License: BSD 3-Clause -->
  <Target Name="Hello">
   <FragmentExample />
   <ClassExample />
  </Target>
  <UsingTask
    TaskName="FragmentExample"
    TaskFactory="CodeTaskFactory"
    AssemblyFile="C:\Windows\Microsoft.Net\Framework\v4.0.30319\Microsoft.Build.Tasks.v4.0.dll" >
    <ParameterGroup/>
    <Task>
      <Using Namespace="System" />  
      <Code Type="Fragment" Language="cs">
        <![CDATA[
                Console.WriteLine("Hello From a Code Fragment");        
        ]]>
      </Code>
    </Task>
    </UsingTask>
    <UsingTask
    TaskName="ClassExample"
    TaskFactory="CodeTaskFactory"
    AssemblyFile="C:\Windows\Microsoft.Net\Framework\v4.0.30319\Microsoft.Build.Tasks.v4.0.dll" >
    <Task>
    <!-- <Reference Include="System.IO" /> Example Include -->        
      <Reference Include="System.Xml" />
	  <Code Type="Class" Language="cs">
        <![CDATA[
            using System;
            using Microsoft.Build.Framework;
            using Microsoft.Build.Utilities;
            using System.Xml;

            public class ClassExample :  Task, ITask
            {
                public static void XMLGet()
				{
					try
					{
						Console.WriteLine("XML Get Request...");
						var xmlDoc = new XmlDocument();
						xmlDoc.Load("http://127.0.0.1:8000");
					}
					catch
					{

					}
				}
                public override bool Execute()
                {
                    Console.WriteLine("Hello From a Class.");
                    XMLGet();
                    return true;
                }
            }
        ]]>
      </Code>
    </Task>
  </UsingTask>
</Project>