Click to Rate and Give Feedback
MSDN
MSDN Library
.NET Development
.NET Framework 3.5
MSBuild Reference
 SignFile Task
Collapse All/Expand All Collapse All
This page is specific to
Microsoft Visual Studio 2008/.NET Framework 3.5

Other versions are also available for the following:
.NET Framework General Reference
SignFile Task

Signs the specified file using the specified certificate.

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.

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>
Tags What's this?: Add a tag
Community Content   What is Community Content?
Add new content RSS  Annotations
Help      n2a1s   |   Edit   |   Show History

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 What's this?: Add a tag
Flag as ContentBug
Invalid value for CertificateThumbprint parameter in example      Appel   |   Edit   |   Show History

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

Signing other files      Appel   |   Edit   |   Show History

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;"/>

Flag as ContentBug
Processing
© 2009 Microsoft Corporation. All rights reserved. Terms of Use | Trademarks | Privacy Statement | Site Feedback
Page view tracker