Skip to content

Instantly share code, notes, and snippets.

@derekxmartin
Last active February 17, 2026 18:24
Show Gist options
  • Select an option

  • Save derekxmartin/7368d20f02af37085412dca4cd2e6376 to your computer and use it in GitHub Desktop.

Select an option

Save derekxmartin/7368d20f02af37085412dca4cd2e6376 to your computer and use it in GitHub Desktop.
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Target Name="Build">
<Message Text="Standard build target" />
</Target>
</Project>
using Microsoft.Build.Framework;
using System;
using System.IO;
// Benign test logger — writes to a temp file to prove execution
// Implements ILogger which MSBuild loads via /logger: switch
public class TestLogger : ILogger
{
public LoggerVerbosity Verbosity { get; set; }
public string Parameters { get; set; }
public void Initialize(IEventSource eventSource)
{
// This executes immediately when MSBuild loads the logger
string output = "[MSB-11 TEST] Logger DLL loaded at {DateTime.Now} by {Environment.UserName}";
File.WriteAllText(@"C:\Temp\logger_dll_test_output.txt", output);
// Simulate discovery command (benign — whoami to file)
var psi = new System.Diagnostics.ProcessStartInfo("cmd.exe", "/c whoami /all >> C:\\Temp\\logger_dll_test_output.txt")
{
CreateNoWindow = true,
UseShellExecute = false
};
System.Diagnostics.Process.Start(psi);
}
public void Shutdown() { }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment