|
1 | 1 | <?xml version="1.0" encoding="utf-8"?> |
2 | | -<Project ToolsVersion="12.0" DefaultTargets="SignFiles" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> |
3 | | - |
4 | | - <!-- must set the default before importing targets --> |
5 | | - <PropertyGroup> |
6 | | - <SignType Condition="'$(SignType)' == ''">test</SignType> |
7 | | - <StrongNameSig>Silverlight</StrongNameSig> |
8 | | - </PropertyGroup> |
| 2 | +<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> |
9 | 3 |
|
10 | 4 | <Import Project="..\dir.props"/> |
11 | 5 | <Import Project="..\dir.targets" /> |
12 | 6 |
|
13 | | - <!-- OutDir is used by the MicroBuild signing target --> |
14 | 7 | <PropertyGroup> |
| 8 | + <!-- The SignFiles target needs OutDir to be defined --> |
15 | 9 | <OutDir>$(BinDir)</OutDir> |
16 | 10 | </PropertyGroup> |
17 | 11 |
|
18 | 12 | <UsingTask AssemblyFile="$(BuildToolsTaskDir)Microsoft.DotNet.Build.Tasks.dll" TaskName="ReadSigningRequired" /> |
19 | 13 |
|
20 | | - <!-- apply the default signing certificates (defined in sign.targets) --> |
21 | | - <ItemDefinitionGroup> |
22 | | - <FilesToSign> |
23 | | - <Authenticode>$(AuthenticodeSig)</Authenticode> |
24 | | - <StrongName>$(StrongNameSig)</StrongName> |
25 | | - </FilesToSign> |
26 | | - </ItemDefinitionGroup> |
27 | | - |
28 | | - <!-- gather the list of binaries to sign with the default certificates --> |
29 | 14 | <ItemGroup> |
30 | | - <FilesToSign Include="$(BinDir)*.dll" Exclude="$(BinDir)*.ni.dll" /> |
31 | | - <FilesToSign Include="$(BinDir)*.exe" /> |
| 15 | + <WindowsNativeLocation Include="$(BinDir)*.dll" /> |
| 16 | + <WindowsNativeLocation Include="$(BinDir)*.exe" /> |
32 | 17 | </ItemGroup> |
33 | 18 |
|
34 | | - <!-- |
35 | | - for some reason the signing task incorrectly attemps to strong-name sign |
36 | | - native images which causes the signing step to fail for obvious reasons. |
37 | | - --> |
38 | | - <ItemGroup> |
39 | | - <FilesToSign Include="$(BinDir)*.ni.dll"> |
40 | | - <StrongName>None</StrongName> |
41 | | - </FilesToSign> |
42 | | - </ItemGroup> |
| 19 | + <Target Name="GenerateSignForWindowsNative"> |
| 20 | + <!-- |
| 21 | + Managed assemblies should already have a requires_signing file dropped so only generate |
| 22 | + a requires_signing file for ones that don't exist which should leave just native assembies |
| 23 | + --> |
| 24 | + <WriteSigningRequired AuthenticodeSig="$(AuthenticodeSig)" |
| 25 | + MarkerFile="%(WindowsNativeLocation.Identity).requires_signing" |
| 26 | + Condition="!Exists('%(WindowsNativeLocation.Identity).requires_signing')" /> |
| 27 | + </Target> |
43 | 28 |
|
44 | 29 | <!-- populates item group FilesToSign with the list of files to sign --> |
45 | | - <Target Name="GetFilesToSignItems" BeforeTargets="SignFiles"> |
| 30 | + <Target Name="GetFilesToSignItems" |
| 31 | + DependsOnTargets="GenerateSignForWindowsNative"> |
46 | 32 | <!-- read all of the marker files and populate the FilesToSign item group --> |
47 | 33 | <ItemGroup> |
48 | 34 | <SignMarkerFile Include="$(OutDir)**\*.requires_signing" /> |
49 | 35 | </ItemGroup> |
50 | 36 | <ReadSigningRequired MarkerFiles="@(SignMarkerFile)"> |
51 | 37 | <Output TaskParameter="SigningMetadata" ItemName="FilesToSign" /> |
52 | 38 | </ReadSigningRequired> |
| 39 | + |
| 40 | + <Message Importance="High" Text="Attempting to sign %(FilesToSign.Identity) with authenticode='%(FilesToSign.Authenticode)' and strongname='%(FilesToSign.StrongName)'" /> |
| 41 | + |
53 | 42 | </Target> |
54 | 43 |
|
55 | | - <!-- now that signing is done clean up any marker files --> |
56 | | - <Target Name="CleanUpMarkerFiles" AfterTargets="SignFiles"> |
| 44 | + <Target Name="Build" |
| 45 | + Condition="'$(SkipSigning)' != 'true' and '$(SignType)' != 'oss'" |
| 46 | + DependsOnTargets="GetFilesToSignItems;SignFiles"> |
| 47 | + |
57 | 48 | <!-- now that the files have been signed delete the marker files --> |
58 | 49 | <Delete Files="@(SignMarkerFile)" /> |
59 | 50 | </Target> |
|
0 commit comments