Info
| Version: | 1.5.1 |
| Author(s): | Microsoft |
| Last Update: | Monday, February 23, 2026 |
| .NET Fiddle: | Create the first Fiddle |
| Project Url: | https://docs.microsoft.com/en-us/windows/security/threat-protection/windows-defender-application-control/windows-defender-application-control |
| NuGet Url: | https://www.nuget.org/packages/Microsoft.Security.CodeIntegrity |
Install
Install-Package Microsoft.Security.CodeIntegrity
dotnet add package Microsoft.Security.CodeIntegrity
paket add Microsoft.Security.CodeIntegrity
Microsoft.Security.CodeIntegrity Download (Unzip the "nupkg" after downloading)
Defender Application Control policies.
This assembly is officially supported only for Windows Server
editions, versions 2016 and above.
Usage examples:
// Parse an XML file and convert it to binary
// Create a FileStream and MemoryStream
FileStream xmlInputFile = null;
MemoryStream binaryOutputStream = null;
try
{
xmlInputFile = new FileStream(xmlFilePath, FileMode.Open, FileAccess.Read);
binaryOutputStream = new MemoryStream();
// Call ConvertFromCodeIntegrityPolicy to convert XML to binary
Microsoft.Security.CodeIntegrity.Policy.ConvertFromCodeIntegrityPolicy(xmlInputFile, binaryOutputStream);
// Write to binary file
File.WriteAllBytes(binaryFilePath, binaryOutputStream.ToArray());
// Write out binary file
// [code]
}
catch
{
throw new Exception();
}.