summaryrefslogtreecommitdiffstats
path: root/tools/DotNetOpenAuth.targets
diff options
context:
space:
mode:
Diffstat (limited to 'tools/DotNetOpenAuth.targets')
-rw-r--r--tools/DotNetOpenAuth.targets69
1 files changed, 69 insertions, 0 deletions
diff --git a/tools/DotNetOpenAuth.targets b/tools/DotNetOpenAuth.targets
index 9a2c6f9..cab4413 100644
--- a/tools/DotNetOpenAuth.targets
+++ b/tools/DotNetOpenAuth.targets
@@ -2,12 +2,27 @@
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
<Import Project="DotNetOpenAuth.Versioning.targets" />
<Import Project="JavascriptPacker.targets" />
+ <UsingTask AssemblyFile="$(ProjectRoot)lib\MSBuild.Community.Tasks.dll" TaskName="ILMerge"/>
+
+ <!-- Prevent our own item types from appearing in Solution Explorer. -->
+ <ItemDefinitionGroup>
+ <SignDependsOn>
+ <Visible>false</Visible>
+ </SignDependsOn>
+ <DelaySignedAssemblies>
+ <Visible>false</Visible>
+ </DelaySignedAssemblies>
+ </ItemDefinitionGroup>
<PropertyGroup>
<DefineConstants Condition=" '$(SignAssembly)' == 'true' ">$(DefineConstants);StrongNameSigned</DefineConstants>
<DefineConstants Condition=" '$(ClrVersion)' == '4' ">$(DefineConstants);CLR4</DefineConstants>
</PropertyGroup>
+ <ItemGroup>
+ <DelaySignedAssemblies Include="$(TargetPath)" Condition=" '$(SuppressTargetPathDelaySignedAssembly)' != 'true' "/>
+ </ItemGroup>
+
<ItemGroup Condition=" '$(ClrVersion)' != '4' ">
<Reference Include="Microsoft.Contracts, Version=1.0.0.0, Culture=neutral, PublicKeyToken=736440c9b414ea16, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
@@ -48,4 +63,58 @@
<Output TaskParameter="AccessorAssembly" ItemName="ReferencePath" />
</Publicize>
</Target>
+
+ <Target Name="Sign" DependsOnTargets="@(SignDependsOn)" Outputs="@(SignedDependencies);@(SignedAssemblyTargets)" Condition=" '@(DelaySignedAssemblies)' != '' ">
+ <!-- Make sure that all dependencies are also signed. -->
+ <MSBuild Projects="@(ProjectReference)" Targets="Sign" BuildInParallel="$(BuildInParallel)">
+ <Output TaskParameter="TargetOutputs" ItemName="SignedDependencies"/>
+ </MSBuild>
+
+ <!-- Add the resource assemblies. -->
+ <ItemGroup>
+ <!-- Make sure that we consider the TargetPath's satellites even if TargetPath itself was suppressed. -->
+ <DelaySignedAssembliesForSatellites Include="@(DelaySignedAssemblies)" />
+ <DelaySignedAssembliesForSatellites Include="$(TargetPath)" Condition=" '$(SuppressTargetPathDelaySignedAssembly)' == 'true' "/>
+ </ItemGroup>
+ <PropertyGroup>
+ <DelaySignedSatelliteAssembliesPattern>@(DelaySignedAssembliesForSatellites->'%(RootDir)%(Directory)*\%(FileName).resources.*')</DelaySignedSatelliteAssembliesPattern>
+ </PropertyGroup>
+ <ItemGroup>
+ <DelaySignedSatelliteAssemblies Include="$(DelaySignedSatelliteAssembliesPattern)" />
+ <DelaySignedSatelliteAssemblies>
+ <CultureDir>$([System.IO.Path]::GetFileName($([System.IO.Path]::GetDirectoryName('%(Directory)'))))\</CultureDir>
+ </DelaySignedSatelliteAssemblies>
+ </ItemGroup>
+
+ <!-- Don't sign assemblies in place. Lots of reasons for this, not the least of which is that
+ subsequent builds of web site projects will cause the satellite assemblies to be regenerated (bizarre)
+ and erase the signature. -->
+ <ItemGroup>
+ <AssembliesToSign Include="@(DelaySignedAssemblies);@(DelaySignedSatelliteAssemblies)" />
+ <SignedAssemblyTargets Include="@(AssembliesToSign->'%(RootDir)%(Directory)$(SignedSubPath)%(FileName)%(Extension)')">
+ <UnsignedAssemblyPath>%(AssembliesToSign.Identity)</UnsignedAssemblyPath>
+ <SymbolPath Condition="Exists('%(RootDir)%(Directory)%(FileName).pdb')">%(RootDir)%(Directory)%(FileName).pdb</SymbolPath>
+ </SignedAssemblyTargets>
+ </ItemGroup>
+
+ <Message Text="Signing delay-signed assemblies using key pair container $(KeyPairContainer)." />
+ <Copy SourceFiles="@(AssembliesToSign)" DestinationFiles="@(SignedAssemblyTargets)" />
+ <ReSignDelaySignedAssemblies
+ KeyContainer="$(KeyPairContainer)"
+ Assemblies="@(SignedAssemblyTargets)"
+ Condition="Exists(%(Identity))" />
+ </Target>
+
+ <Target Name="ResignDelaySignedAssemblies" Outputs="@(ResignedAssembliesOutputs)">
+ <ItemGroup>
+ <DelaySignedProjects Include="
+ $(ProjectRoot)src\dotnetopenauth\dotnetopenauth.csproj;
+ $(ProjectRoot)src\dotnetopenauth.test\dotnetopenauth.test.csproj;
+ $(ProjectRoot)samples\openidofflineprovider\openidofflineprovider.csproj;
+ " />
+ </ItemGroup>
+ <MSBuild Projects="@(DelaySignedProjects)" Targets="Sign" BuildInParallel="$(BuildInParallel)">
+ <Output TaskParameter="TargetOutputs" ItemName="ResignedAssembliesOutputs"/>
+ </MSBuild>
+ </Target>
</Project>