|
<!-- Licensed to the .NET Foundation under one or more agreements. The .NET Foundation licenses this file to you under the MIT license. -->
<Project>
<!--
Reads variables:
SignAssembly "true" to sign the output assembly of the current project
FullAssemblySigningSupported "false" to use public signing even when full signing is possible. This is useful
in environments where full signing is non-functional or not desired. For example,
in some Linux distributions RSA+SHA1 (required for full signing) is not
functional/available, and trying to use full signing results in the runtime
throwing an exception. For more details and an example, see
https://github.com/dotnet/runtime/issues/65874.
StrongNameKeyId The id of the key used for strong name generation
Writes variables:
DelaySign
PublicSign
PublicKey
PublicKeyToken
AssemblyOriginatorKeyFile
-->
<PropertyGroup Condition="'$(SignAssembly)' != 'false'">
<DelaySign>false</DelaySign>
<PublicSign>true</PublicSign>
</PropertyGroup>
<!-- Binaries are delay or public-signed with one of these keys; later, the signing system will finish the strong-name signing. -->
<Choose>
<When Condition="'$(SignAssembly)' == 'false'" />
<When Condition="'$(StrongNameKeyId)' == 'Microsoft'">
<PropertyGroup>
<AssemblyOriginatorKeyFile>$(MSBuildThisFileDirectory)snk/MSFT.snk</AssemblyOriginatorKeyFile>
<PublicKey>$(MicrosoftPublicKey)</PublicKey>
<PublicKeyToken>b03f5f7f11d50a3a</PublicKeyToken>
</PropertyGroup>
</When>
<When Condition="'$(StrongNameKeyId)' == 'MicrosoftShared'">
<PropertyGroup>
<AssemblyOriginatorKeyFile>$(MSBuildThisFileDirectory)snk/35MSSharedLib1024.snk</AssemblyOriginatorKeyFile>
<PublicKey>$(MicrosoftSharedPublicKey)</PublicKey>
<PublicKeyToken>31BF3856AD364E35</PublicKeyToken>
</PropertyGroup>
</When>
<When Condition="'$(StrongNameKeyId)' == 'MicrosoftAspNetCore'">
<PropertyGroup>
<AssemblyOriginatorKeyFile>$(MSBuildThisFileDirectory)snk/AspNetCore.snk</AssemblyOriginatorKeyFile>
<PublicKey>$(MicrosoftAspNetCorePublicKey)</PublicKey>
<PublicKeyToken>adb9793829ddae60</PublicKeyToken>
<PublicSign Condition="'$(FullAssemblySigningSupported)' != 'false'">false</PublicSign> <!-- The MicrosoftAspNetCore strong name key is a full key -->
</PropertyGroup>
</When>
<When Condition="'$(StrongNameKeyId)' == 'ECMA'">
<PropertyGroup>
<AssemblyOriginatorKeyFile>$(MSBuildThisFileDirectory)snk/ECMA.snk</AssemblyOriginatorKeyFile>
<PublicKey>$(ECMAPublicKey)</PublicKey>
<PublicKeyToken>b77a5c561934e089</PublicKeyToken>
</PropertyGroup>
</When>
<!--
The Open key can be used by any library that needs strong name signing that doesn't
have to be protected by the closed MS based keys. The idea is to have a key for identity but
not for any security purposes.
-->
<When Condition="'$(StrongNameKeyId)' == 'Open'">
<PropertyGroup>
<AssemblyOriginatorKeyFile>$(MSBuildThisFileDirectory)snk/Open.snk</AssemblyOriginatorKeyFile>
<PublicKey>$(OpenPublicKey)</PublicKey>
<PublicKeyToken>cc7b13ffcd2ddd51</PublicKeyToken>
<DelaySign>false</DelaySign>
<PublicSign Condition="'$(FullAssemblySigningSupported)' != 'false'">false</PublicSign> <!-- The Open strong name key is a full key -->
</PropertyGroup>
</When>
<When Condition="'$(StrongNameKeyId)' == 'SilverlightPlatform'">
<PropertyGroup>
<AssemblyOriginatorKeyFile>$(MSBuildThisFileDirectory)snk/SilverlightPlatformPublicKey.snk</AssemblyOriginatorKeyFile>
<PublicKey>$(SilverlightPlatformPublicKey)</PublicKey>
<PublicKeyToken>7cec85d7bea7798e</PublicKeyToken>
</PropertyGroup>
</When>
</Choose>
<!-- Build Flag Verification -->
<PropertyGroup>
<PrepareForBuildDependsOn>$(PrepareForBuildDependsOn);VerifyBuildFlags</PrepareForBuildDependsOn>
</PropertyGroup>
<Target Name="VerifyBuildFlags">
<Error Condition="'$(SignAssembly)' != 'false' and
('$(PublicKey)' == '' or '$(PublicKeyToken)' == '' or '$(AssemblyOriginatorKeyFile)' == '')"
Text="PublicKey, PublicKeyToken and AssemblyOriginatorKeyFile must be specified" />
</Target>
</Project>
|