summaryrefslogtreecommitdiff
path: root/src/sign.builds
blob: a8652b3ff431980fd51035376b14f31ce20ff5eb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="SignFiles" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">

  <!-- must set the default before importing targets -->
  <PropertyGroup>
    <SignType Condition="'$(SignType)' == ''">test</SignType>
    <StrongNameSig>Silverlight</StrongNameSig>
  </PropertyGroup>

  <Import Project="..\dir.props"/>
  <Import Project="..\dir.targets" />

  <!-- OutDir is used by the MicroBuild signing target -->
  <PropertyGroup>
    <OutDir>$(BinDir)</OutDir>
  </PropertyGroup>

  <UsingTask AssemblyFile="$(BuildToolsTaskDir)Microsoft.DotNet.Build.Tasks.dll" TaskName="ReadSigningRequired" />

  <!-- apply the default signing certificates (defined in sign.targets) -->
  <ItemDefinitionGroup>
    <FilesToSign>
      <Authenticode>$(AuthenticodeSig)</Authenticode>
      <StrongName>$(StrongNameSig)</StrongName>
    </FilesToSign>
  </ItemDefinitionGroup>

  <!-- gather the list of binaries to sign with the default certificates -->
  <ItemGroup>
    <FilesToSign Include="$(BinDir)*.dll" Exclude="$(BinDir)*.ni.dll" />
    <FilesToSign Include="$(BinDir)*.exe" />
  </ItemGroup>

  <!--
    for some reason the signing task incorrectly attemps to strong-name sign
    native images which causes the signing step to fail for obvious reasons.
  -->
  <ItemGroup>
    <FilesToSign Include="$(BinDir)*.ni.dll">
      <StrongName>None</StrongName>
    </FilesToSign>
  </ItemGroup>

  <!-- populates item group FilesToSign with the list of files to sign -->
  <Target Name="GetFilesToSignItems" BeforeTargets="SignFiles">
    <!-- read all of the marker files and populate the FilesToSign item group -->
    <ItemGroup>
      <SignMarkerFile Include="$(OutDir)**\*.requires_signing" />
    </ItemGroup>
    <ReadSigningRequired MarkerFiles="@(SignMarkerFile)">
      <Output TaskParameter="SigningMetadata" ItemName="FilesToSign" />
    </ReadSigningRequired>
  </Target>

  <!-- now that signing is done clean up any marker files -->
  <Target Name="CleanUpMarkerFiles" AfterTargets="SignFiles">
    <!-- now that the files have been signed delete the marker files -->
    <Delete Files="@(SignMarkerFile)" />
  </Target>

</Project>