Skip to content

Instantly share code, notes, and snippets.

@derekxmartin
Created February 17, 2026 15:29
Show Gist options
  • Select an option

  • Save derekxmartin/98837d58e7e362b2c9a0a5a0ca29f3e7 to your computer and use it in GitHub Desktop.

Select an option

Save derekxmartin/98837d58e7e362b2c9a0a5a0ca29f3e7 to your computer and use it in GitHub Desktop.
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Target Name="TestTarget">
<TestTask />
</Target>
<UsingTask
TaskName="TestTask"
TaskFactory="CodeTaskFactory"
AssemblyFile="C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Microsoft.Build.Tasks.v4.0.dll">
<Task>
<Using Namespace="System.IO" />
<Code Type="Fragment" Language="cs">
<![CDATA[
string user = System.Security.Principal.WindowsIdentity.GetCurrent().Name;
File.WriteAllText(@"C:\Temp\msbuild_test_output.txt", "Test executed by: " + user);
]]>
</Code>
</Task>
</UsingTask>
</Project>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment