|
35 | 35 | --> |
36 | 36 | <PropertyGroup Condition="'$(WebPublishMethod)' == 'Package'"> |
37 | 37 | <EnumerateFilesToSignAfterTargets>PipelineCopyAllFilesToOneFolderForMsdeploy</EnumerateFilesToSignAfterTargets> |
38 | | - <PackageUsingManifestDependsOn>SignFiles</PackageUsingManifestDependsOn> |
| 38 | + <PackageUsingManifestDependsOn>CopySignedFiles</PackageUsingManifestDependsOn> |
39 | 39 | </PropertyGroup> |
40 | 40 |
|
41 | 41 | <!-- |
|
46 | 46 | things. |
47 | 47 | --> |
48 | 48 | <ItemGroup Condition="'$(BatchSign)' == 'false'"> |
49 | | - <SignFilesDependsOn Include="EnumerateFilesToSign" /> |
| 49 | + <SignFilesDependsOn Include="DedupeFilesToSign" /> |
50 | 50 | </ItemGroup> |
51 | 51 | <Target |
52 | 52 | Name="EnumerateFilesToSign" |
53 | 53 | AfterTargets="$(EnumerateFilesToSignAfterTargets)" |
54 | 54 | Condition="'$(SignAssembly)' == 'true' AND '$(SignType)' != 'none' AND '$(SkipEnumerateFilesToSign)' != 'true'" |
55 | | - Returns="@(FilesToSign)"> |
| 55 | + Returns="@(UnfilteredFilesToSign)"> |
56 | 56 |
|
57 | 57 | <ItemGroup> |
58 | 58 | <!-- |
|
66 | 66 | bin directory of another project. That assembly also needs to be signed. |
67 | 67 | --> |
68 | 68 | <_OutputToSign Include="$(RepositoryRootDirectory)**\$(TargetFileName)" Condition="'$(BatchSign)' == 'true'" /> |
69 | | - <FilesToSign |
| 69 | + <UnfilteredFilesToSign |
70 | 70 | Include="$([System.IO.Path]::GetFullPath('%(_OutputToSign.Identity)'))" |
71 | 71 | Condition="Exists('%(_OutputToSign.Identity)')" |
72 | 72 | KeepDuplicates="false"> |
73 | 73 | <Authenticode>Microsoft400</Authenticode> |
74 | 74 | <StrongName>MsSharedLib72</StrongName> |
75 | | - </FilesToSign> |
| 75 | + </UnfilteredFilesToSign> |
76 | 76 |
|
77 | 77 | <!-- |
78 | 78 | Add fully qualified paths for PowerShell scripts. By convention, add common scripts that we use for jobs. |
79 | 79 | --> |
80 | 80 | <PowerShellScriptsToSign Include="Scripts\Functions.ps1"/> |
81 | 81 | <PowerShellScriptsToSign Include="Scripts\PostDeploy.ps1"/> |
82 | 82 | <PowerShellScriptsToSign Include="Scripts\PreDeploy.ps1"/> |
83 | | - <FilesToSign |
| 83 | + <UnfilteredFilesToSign |
84 | 84 | Include="$([System.IO.Path]::GetFullPath('$(ProjectDir)%(PowerShellScriptsToSign.Identity)'))" |
85 | 85 | Condition="Exists('$(ProjectDir)%(PowerShellScriptsToSign.Identity)')" |
86 | 86 | KeepDuplicates="false"> |
87 | 87 | <Authenticode>Microsoft400</Authenticode> |
88 | | - </FilesToSign> |
| 88 | + </UnfilteredFilesToSign> |
89 | 89 |
|
90 | 90 | <!-- |
91 | 91 | Add fully qualified paths for checked in binaries. By convention, add common binaries that we use for jobs. |
92 | 92 | --> |
93 | 93 | <ExecutablesToSign Include="Scripts\nssm.exe"/> |
94 | | - <FilesToSign |
| 94 | + <UnfilteredFilesToSign |
95 | 95 | Include="$([System.IO.Path]::GetFullPath('$(ProjectDir)%(ExecutablesToSign.Identity)'))" |
96 | 96 | Condition="Exists('$(ProjectDir)%(ExecutablesToSign.Identity)')" |
97 | 97 | KeepDuplicates="false"> |
98 | 98 | <Authenticode>3PartySHA2</Authenticode> |
99 | | - </FilesToSign> |
| 99 | + </UnfilteredFilesToSign> |
100 | 100 |
|
101 | 101 | <!-- |
102 | 102 | Add fully qualified paths for third-party binaries. |
103 | 103 | --> |
104 | | - <FilesToSign |
| 104 | + <UnfilteredFilesToSign |
105 | 105 | Include="$([System.IO.Path]::GetFullPath('$(TargetDir)%(ThirdPartyBinaries.Identity)'))" |
106 | 106 | Condition="@(ThirdPartyBinaries->Count()) > 0 AND Exists('$(TargetDir)%(ThirdPartyBinaries.Identity)')" |
107 | 107 | KeepDuplicates="false"> |
108 | 108 | <Authenticode>3PartySHA2</Authenticode> |
109 | | - </FilesToSign> |
| 109 | + </UnfilteredFilesToSign> |
110 | 110 | </ItemGroup> |
111 | 111 |
|
112 | 112 | <!-- |
113 | 113 | When we are building a web app package, sign the third party assemblies and output assembly from the single folder |
114 | 114 | used for packaging. |
115 | 115 | --> |
116 | 116 | <ItemGroup Condition="'$(WebPublishMethod)' == 'Package'"> |
117 | | - <FilesToSign |
| 117 | + <UnfilteredFilesToSign |
118 | 118 | Include="$(WPPAllFilesInSingleFolder)\bin\%(ThirdPartyBinaries.Identity)" |
119 | 119 | Condition="Exists('$(WPPAllFilesInSingleFolder)\bin\%(ThirdPartyBinaries.Identity)')"> |
120 | 120 | <Authenticode>3PartySHA2</Authenticode> |
121 | | - </FilesToSign> |
122 | | - <FilesToSign |
| 121 | + </UnfilteredFilesToSign> |
| 122 | + <UnfilteredFilesToSign |
123 | 123 | Include="$(WPPAllFilesInSingleFolder)\bin\$(TargetFileName)" |
124 | 124 | Condition="Exists('$(WPPAllFilesInSingleFolder)\bin\$(TargetFileName)')"> |
125 | 125 | <Authenticode>Microsoft400</Authenticode> |
126 | 126 | <StrongName>MsSharedLib72</StrongName> |
127 | | - </FilesToSign> |
| 127 | + </UnfilteredFilesToSign> |
128 | 128 | </ItemGroup> |
| 129 | + </Target> |
129 | 130 |
|
| 131 | + <Target |
| 132 | + Name="DedupeFilesToSign" |
| 133 | + DependsOnTargets="EnumerateFilesToSign"> |
| 134 | + <FindDuplicateFiles Files="@(UnfilteredFilesToSign)"> |
| 135 | + <Output |
| 136 | + TaskParameter="UniqueFiles" |
| 137 | + ItemName="FilesToSign" /> |
| 138 | + <Output |
| 139 | + TaskParameter="DuplicateFiles" |
| 140 | + ItemName="DuplicateFilesToSign" /> |
| 141 | + </FindDuplicateFiles> |
130 | 142 | <Message Text="Count of files to sign: @(FilesToSign->Count())" Importance="High" /> |
131 | 143 | <Message Text="Files to sign:%0A@(FilesToSign, '%0A')" Importance="High" /> |
| 144 | + </Target> |
| 145 | + |
| 146 | + <Target Name="CopySignedFiles" |
| 147 | + AfterTargets="SignFiles" |
| 148 | + DependsOnTargets="SignFiles"> |
| 149 | + <Copy |
| 150 | + SourceFiles="@(DuplicateFilesToSign->'%(DuplicateOf)')" |
| 151 | + DestinationFiles="@(DuplicateFilesToSign)" /> |
132 | 152 | </Target> |
| 153 | + |
| 154 | + <Import Project="FindDuplicateFiles.targets" /> |
133 | 155 | </Project> |
0 commit comments