Skip to content

Commit

Permalink
update code signing
Browse files Browse the repository at this point in the history
  • Loading branch information
mrlacey committed Oct 18, 2024
1 parent b2ccbb7 commit e62ce3c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 12 deletions.
3 changes: 0 additions & 3 deletions src/CollapseComments.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -140,9 +140,6 @@
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="Microsoft.VSSDK.Vsixsigntool">
<Version>16.2.29116.78</Version>
</PackageReference>
<PackageReference Include="StyleCop.Analyzers">
<Version>1.2.0-beta.164</Version>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
Expand Down
17 changes: 8 additions & 9 deletions src/signvsix.targets
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
<?xml version="1.0" encoding="utf-8" ?>
<Project ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<VsixSignTool>$(NuGetPackageRoot)Microsoft.VSSDK.Vsixsigntool\16.2.29116.78\tools\vssdk\vsixsigntool.exe</VsixSignTool>
<VsixSignCommand>$(VsixSignTool) sign /f $(SIGN_CERTIFICATE) /p $(SIGN_PASSWORD) /sha1 $(SIGN_CERT_HASH) /fd sha256</VsixSignCommand>
</PropertyGroup>
<Target Name="AfterBuild" DependsOnTargets="CoreCompile" Condition="Exists('$(SIGN_CERTIFICATE)')">
<Message Text="Signing $(TargetVsixContainer)" Condition="'$(Configuration)' == 'Release'" />
<Exec Command="$(VsixSignCommand) $(MSBuildProjectDirectory)\$(TargetVsixContainer)" Condition="'$(Configuration)' == 'Release'" />
<Exec Command="powershell -NonInteractive -executionpolicy Unrestricted -command &quot;&amp; { [XML]$xml = Get-Content .\source.extension.vsixmanifest; $version = $xml.PackageManifest.Metadata.Identity.Version; $verUnder = $version -replace '\.', '_'; $newExt = [System.String]::Concat($verUnder,&apos;.vsix&apos;); $newFileName = &apos;$(TargetVsixContainer)&apos; -Replace &apos;vsix&apos;, $newExt; Copy-Item $(MSBuildProjectDirectory)\$(TargetVsixContainer) -Destination $(MSBuildProjectDirectory)\$newFileName; Write-Host $newFileName; } &quot;" Condition="'$(Configuration)' == 'Release'" />
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Target Name="AfterBuild" DependsOnTargets="CoreCompile" Condition="'$(SM_CERT_FP_SHA256)' != ''">
<Message Text="Signing $(TargetVsixContainer)" Condition="'$(Configuration)' == 'Release'" Importance="High" />
<Exec Command="sign code certificate-store -cfp $(SM_CERT_FP_SHA256) -csp &quot;DigiCert Software Trust Manager KSP&quot; -k $(SM_KP) -u &quot;http://timestamp.digicert.com&quot; $(MSBuildProjectDirectory)\$(TargetVsixContainer)" Condition="'$(Configuration)' == 'Release'" ConsoleToMSBuild="true">
<Output TaskParameter="ConsoleOutput" PropertyName="OutputOfExec" />
</Exec>
<Message Text="OutputOfExec: (blank if successful) $(OutputOfExec)" Condition="'$(Configuration)' == 'Release'" Importance="High" />
<Exec Command="powershell -NonInteractive -executionpolicy Unrestricted -command &quot;&amp; { [XML]$xml = Get-Content .\source.extension.vsixmanifest; $version = $xml.PackageManifest.Metadata.Identity.Version; $verUnder = $version -replace '\.', '_'; $newExt = [System.String]::Concat($verUnder,&apos;.vsix&apos;); $newFileName = &apos;$(TargetVsixContainer)&apos; -Replace &apos;vsix&apos;, $newExt; Copy-Item $(MSBuildProjectDirectory)\$(TargetVsixContainer) -Destination $(MSBuildProjectDirectory)\$newFileName; Write-Host $newFileName; } &quot;" Condition="'$(Configuration)' == 'Release'" />
</Target>
</Project>

0 comments on commit e62ce3c

Please sign in to comment.