Build-time execution is code or commands that run while a project is being restored, configured, or compiled, before the application starts. In .NET projects, package-provided MSBuild files such as targets can add actions to these stages. This differs from runtime execution, which occurs after the app launches.
This matters in cyber security because a dependency can affect a developer’s machine or build environment, not just the finished application. Malicious packages may use build hooks to run commands, launch processes, or retrieve additional code when a project is built. Defenses include treating unfamiliar packages as untrusted, inspecting package contents and build files, using isolated build environments, and monitoring build processes. A successful build or valid package signature does not by itself show that its behavior is safe.


