> For the complete documentation index, see [llms.txt](https://dmcxblue.gitbook.io/red-team-notes/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://dmcxblue.gitbook.io/red-team-notes/execution/trusted-developer-utilities/msbuild.md).

# MSBuild

Let's get some examples here we can add powershell code onto an XML file have msbuild compile it and execute to call a shell back to us this will automate the process to leverage the MSBuild technique to input a powershell payload into an inline-task XML file that can be launched.

{% embed url="<https://gist.github.com/mgeeky>" %}

I continued with the use of this tool for creating shell's using msbuild and converting the file into an XML format perfect use for MSBuild.

![](/files/-LxYEuRrcRRDjZAea7Fr)

Let's copy this onto our victim machine

We can see that we saved the z.xml file onto the machine (This name can be whatever) . From here we will need to move onto the MSBuild directory and load the executable

![z.xml](/files/-LxYNGpFJlOG6VT__o3k)

![MSBuild Path](/files/-LxYNTKIIaDYIutARlpw)

&#x20;Let's use MSBuild to execute our XML File

![](/files/-LxYTPpQFcq0R8XfVOLs)

We can also execute csproj files as MSBuild compiles these as well.

This tool uses techniques  that are already published as stated on the README `This script will generate payloads for basic intrusion detection avoidance. It utilizes publicly demonstrated techniques from several different sources.`


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://dmcxblue.gitbook.io/red-team-notes/execution/trusted-developer-utilities/msbuild.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
