.NET Framework General Reference
SignFile Task

Signs the specified file using the specified certificate.

Parameters

The following table describes the parameters of the SignFile task.

Parameter

Description

CertificateThumbprint

Required String parameter.

Specifies the certificate to use for signing.

SigningTarget

Required ITaskItem parameter.

Specifies the files to sign with the certificate.

TimestampUrl

Optional String parameter.

Specifies the URL of a time stamping server.

Example

The following example uses the SignFile task to sign the files specified in the FilesToSign item collection with the certificate specified by the Certificate property.

<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">

    <ItemGroup>
        <FileToSign Include="File.exe" />
    <ItemGroup>

    <PropertyGroup>
        <Certificate>Cert.cer</Certificate>
    </PropertyGroup>

    <Target Name="Sign">
        <SignFile
            CertificateThumbprint="$(CertificateThumbprint)"
            SigningTarget="@(FileToSign)" />
    </Target>

</Project>
See Also

Concepts

Other Resources

Tags :


Community Content

n2a1s
Help

I have been publishing home developed software prepared under the following systems: Windows XP - SP2, Visusl Studio 2005 - Visual Basic.

Now I have upgraded to Windows Vista Enterprise. Publishing now fails because

  1. a project fails to build.
  2. a "SignFile" task was not given a value for the required parameter "CertificateThumbprint".

I am mystfied by this. Can you help?

Thanks
Tags :

Appel
Invalid value for CertificateThumbprint parameter in example

The only valid value for CertificateThumbprint is the SHA1 hash of the certificate, so the example can never work.


Appel
Signing other files

The SignFile task only supports signing PE files and XML files so it can't be used with other file types.

To sign other file types from MSBuild use the Exec task and signtool.exe. In the example below signtool.exe is expected to be found on the path and certificate is stored in the current users personal certificate store. The TargetPath is the path to any file type that can be signed by signtool, for example a windows installer package (.msi).

<Exec Command="signtool.exe sign /sha1 $(CertificateThumbprint) /t $(TimestampUrl) &quot;$(TargetPath)&quot;"/>

Tags : example sign

Page view tracker