Certificate Class | MSBuild Extension Pack Help 4.0.12.0 |
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
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.
Name | Description | |
---|---|---|
Certificate |
Name | Description | |
---|---|---|
AccessRights |
The access rights that need to be given.
| |
AccountName |
The name of user or group that needs to be given rights on the given certificate
| |
Base64EncodedCertificate |
Gets or sets the Base 64 Encoded string of the certificate
| |
CertificateExpiryDate |
Gets the Certificate Exprity Date.
| |
CertInfo |
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
| |
CertPassword |
Sets the password for the pfx file from which the certificate is to be imported, defaults to blank
| |
DistinguishedName |
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
| |
Exportable |
Sets a value indicating whether the certificate is exportable.
| |
FileName |
Sets the name of the file.
| |
MachineStore |
Sets a value indicating whether to use the MachineStore. Default is false
| |
StoreName |
Sets the name of the store. Defaults to My
AddressBook: The store for other users | |
SubjectDName |
The distinguished subject name of the certificate
| |
Thumbprint |
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
|
<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>