-
Notifications
You must be signed in to change notification settings - Fork 77
/
Directory.Build.targets
34 lines (26 loc) · 1.56 KB
/
Directory.Build.targets
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
<Project>
<!-- Hook in the targets that will do the signing. -->
<!-- Objective - sign the assemblies before they are packaged into the VSIX.
Unfortunately, we can't just sign all of our binaries that are in the bin
directory of the Integration.VSIX project because of how the VSIX SDK targets
work.
Firstly, the VSIX targets pick up the output assembly from the individual project "bin"
folders (e.g. Core\bin\release\net46\SonarLint.VisualStudio.Core.dll). This is the
case even though SonarLint.VisualStudio.Core.dll is present in the VSIX.Integration "bin"
folder.
Secondly, in some case the VSIX targets can pick the assembly from the "obj" directory
rather than from the "bin" folder.
So, to be on the safe side, we are signing the output assembly in each project in the
"obj" folder before it is copied to the "bin" folder.
-->
<Import Project="$(MSBuildThisFileDirectory)build\Signing.targets" />
<Target Name="SignProjectOutputAssembly" Condition=" '$(RequiresSigning)' == 'true'" BeforeTargets="CopyFilesToOutputDirectory" >
<Message Condition=" $(SignArtifacts) != 'true' " Importance="high" Text="Skipping signing assemblies - SignArtifacts = '$(SignArtifacts)'" />
<CallTarget Condition=" $(SignArtifacts) == 'true' " Targets="LocateIntermediateAssembly;SignAssemblies" />
</Target>
<Target Name="LocateIntermediateAssembly">
<ItemGroup>
<AssembliesToSign Include="$(IntermediateOutputPath)$(TargetFileName)" />
</ItemGroup>
</Target>
</Project>