Certificate ClassMSBuild Extension Pack Help 4.0.12.0
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

Inheritance Hierarchy

SystemObject
  Microsoft.Build.UtilitiesTask
    MSBuild.ExtensionPackBaseTask
      MSBuild.ExtensionPack.SecurityCertificate

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

The Certificate type exposes the following members.

Constructors

  NameDescription
Public methodCertificate
Top
Properties

  NameDescription
Public propertyAccessRights
The access rights that need to be given.
Public propertyAccountName
The name of user or group that needs to be given rights on the given certificate
Public propertyBase64EncodedCertificate
Gets or sets the Base 64 Encoded string of the certificate
Public propertyCertificateExpiryDate
Gets the Certificate Exprity Date.
Public propertyCertInfo
Gets the item which contains the Certificate information. The following Metadata is populated: SubjectName, SignatureAlgorithm, SubjectNameOidValue, SerialNumber, Archived, NotAfter, NotBefore, FriendlyName, HasPrivateKey, Thumbprint, Version, PrivateKeyFileName, IssuerName
Public propertyCertPassword
Sets the password for the pfx file from which the certificate is to be imported, defaults to blank
Public propertyDistinguishedName
Gets the Distinguished Name for the certificate used to to uniquely identify certificate in further tasks. The distinguished name can be used in place of thumbprint to identify a certificate
Public propertyExportable
Sets a value indicating whether the certificate is exportable.
Public propertyFileName
Sets the name of the file.
Public propertyMachineStore
Sets a value indicating whether to use the MachineStore. Default is false
Public propertyStoreName
Sets the name of the store. Defaults to My

AddressBook: The store for other users
AuthRoot: The store for third-party certificate authorities
CertificateAuthority: The store for intermediate certificate authorities
Disallowed: The store for revoked certificates
My: The store for personal certificates
Root: The store for trusted root certificate authorities
TrustedPeople: The store for directly trusted people and resources
TrustedPublisher: The store for directly trusted publishers

Public propertySubjectDName
The distinguished subject name of the certificate
Public propertyThumbprint
Gets the thumbprint. Used to uniquely identify certificate in further tasks The thumprint can be used in place of distinguished name to identify a certificate
Top
Examples

<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>
See Also

Reference