Valid TaskActions are:

Add (Required: FileName Optional: MachineStore, CertPassword, Exportable, StoreName Output: Thumbprint, SubjectDName)

GetBase64EncodedCertificate (Required: Thumbprint or SubjectDName Optional: MachineStore, Output: Base64EncodedCertificate)

GetExpiryDate (Required: Thumbprint or SubjectDName Optional: MachineStore, Output: CertificateExpiryDate)

GetInfo (Required: Thumbprint or SubjectDName Optional: MachineStore, StoreName Output: CertInfo)

Remove (Required: Thumbprint or SubjectDName Optional: MachineStore, StoreName)

SetUserRights (Required: AccountName, Thumbprint or SubjectDName Optional: MachineStore, Output: )

Remote Execution Support: No

Namespace: MSBuild.ExtensionPack.Security
Assembly: MSBuild.ExtensionPack (in MSBuild.ExtensionPack.dll) Version: 4.0.0.0

Examples

CopyXML
<Project ToolsVersion="4.0" DefaultTargets="Default" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
    <PropertyGroup>
        <TPath>$(MSBuildProjectDirectory)\..\MSBuild.ExtensionPack.tasks</TPath>
        <TPath Condition="Exists('$(MSBuildProjectDirectory)\..\..\Common\MSBuild.ExtensionPack.tasks')">$(MSBuildProjectDirectory)\..\..\Common\MSBuild.ExtensionPack.tasks</TPath>
    </PropertyGroup>
    <Import Project="$(TPath)"/>
    <Target Name="Default">
        <!-- Add a certificate -->
        <MSBuild.ExtensionPack.Security.Certificate TaskAction="Add" FileName="C:\MyCertificate.cer" CertPassword="PASSW">
            <Output TaskParameter="Thumbprint" PropertyName="TPrint"/>
            <Output TaskParameter="SubjectDName" PropertyName="SName"/>
        </MSBuild.ExtensionPack.Security.Certificate>
        <Message Text="Thumbprint: $(TPrint)"/>
        <Message Text="SubjectName: $(SName)"/>
        <!-- Get Certificate Information -->
        <MSBuild.ExtensionPack.Security.Certificate TaskAction="GetInfo" SubjectDName="$(SName)">
            <Output TaskParameter="CertInfo" ItemName="ICertInfo" />
        </MSBuild.ExtensionPack.Security.Certificate>
        <Message Text="SubjectName: %(ICertInfo.SubjectName)"/>
        <Message Text="SubjectNameOidValue: %(ICertInfo.SubjectNameOidValue)"/>
        <Message Text="SerialNumber: %(ICertInfo.SerialNumber)"/>
        <Message Text="Archived: %(ICertInfo.Archived)"/>
        <Message Text="NotBefore: %(ICertInfo.NotBefore)"/>
        <Message Text="NotAfter: %(ICertInfo.NotAfter)"/>
        <Message Text="PrivateKeyFileName: %(ICertInfo.PrivateKeyFileName)"/>
        <Message Text="FriendlyName: %(ICertInfo.FriendlyName)"/>
        <Message Text="HasPrivateKey: %(ICertInfo.HasPrivateKey)"/>
        <Message Text="Thumbprint: %(ICertInfo.Thumbprint)"/>
        <Message Text="Version: %(ICertInfo.Version)"/>
        <Message Text="PrivateKeyFileName: %(ICertInfo.PrivateKeyFileName)"/>
        <Message Text="SignatureAlgorithm: %(ICertInfo.SignatureAlgorithm)"/>
        <Message Text="IssuerName: %(ICertInfo.IssuerName)"/>
        <Message Text="PrivateKeyFileName: %(ICertInfo.PrivateKeyFileName)"/>
         <!-- Remove a certificate -->
        <MSBuild.ExtensionPack.Security.Certificate TaskAction="Remove" Thumbprint="$(TPrint)"/>
    </Target>
</Project>

Inheritance Hierarchy

System..::..Object
  Microsoft.Build.Utilities..::..Task
    MSBuild.ExtensionPack..::..BaseTask
      MSBuild.ExtensionPack.Security..::..Certificate

See Also