a0d3b4bd23
Co-Authored-By: Brent Murphy <56412096+bm11100@users.noreply.github.com> Co-Authored-By: Daniel Stepanic <57736958+dstepanic17@users.noreply.github.com> Co-Authored-By: David French <56409778+threat-punter@users.noreply.github.com> Co-Authored-By: Joe Desimone <56411054+joe-desimone@users.noreply.github.com> Co-Authored-By: Justin Ibarra <brokensound77@users.noreply.github.com>
65 lines
1.9 KiB
XML
65 lines
1.9 KiB
XML
<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> |