build/sign.proj (29 lines of code) (raw):
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="All" InitialTargets="CheckCISignRepo" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Root>$(MSBuildThisFileDirectory)..\</Root>
<Configuration Condition="'$(Configuration)' == ''">Release</Configuration>
<Artifacts>$(Root)artifacts\</Artifacts>
<OutputDir>$(Artifacts)$(Configuration)\</OutputDir>
<PowerShell>C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe</PowerShell>
</PropertyGroup>
<Target Name="CheckCISignRepo">
<Error Text="CISignRepo is not assigned a file path!" Condition="'$(CISignRepo)' == ''" />
<Error Text="The CISignRepo directory does not exist!" Condition="!Exists($(CISignRepo))" />
</Target>
<UsingTask TaskName="ESRPSignTask" AssemblyFile="$(CISignRepo)\tools\sdkbuildtools\tasks\MS.Az.Sdk.OnPremise.Build.Tasks.dll" />
<Target Name="All">
<Message Importance="high" Text="Sign: All started" />
<ItemGroup>
<UnsignedFiles Include="$(OutputDir)netstandard2.0\Microsoft.Azure.PowerShell*.dll" Exclude="$(OutputDir)netstandard2.0\Microsoft.Azure.PowerShell*.Test.dll" />
</ItemGroup>
<ESRPSignTask
CopyBackSignedFilesToOriginalLocation="true"
UnsignedFileList="@(UnsignedFiles)"
SignLogDirPath="$(OutputDir)Signing.log" />
<PropertyGroup>
<RemoveSignedUnsignedFolders>Get-ChildItem -Path $(OutputDir) -Recurse -Include 'Signed','Unsigned' | Remove-Item -Recurse -Force -Confirm:$false -ErrorAction Ignore</RemoveSignedUnsignedFolders>
</PropertyGroup>
<Exec Command="$(PowerShell) -NonInteractive -NoLogo -NoProfile -Command "$(RemoveSignedUnsignedFolders)"" ContinueOnError="WarnAndContinue" IgnoreExitCode="true" />
</Target>
</Project>