sign icon indicating copy to clipboard operation
sign copied to clipboard

VSIX signing failed which contains a file with extension ".app"

Open StGabriel opened this issue 1 year ago • 3 comments

Describe the bug VSIX signing does not work if there is an ".app" file inside.

Repro steps I have a Application.app file inside the VSIX extension and the content is a JSON file:

{
  "_Name": "TestApplication"
}

Expected behavior Signing will not fail. The deprecated and legacy version of Microsoft's vsixsigntool can sign the VSIX package.

Actual behavior The VSIX signing fails with the output

[...]
info: Sign.Core.IDataFormatSigner[0]
      Signing SignTool job with 1 files.
trce: Sign.SignatureProviders.CertificateStore.CertificateStoreService[0]
      Fetching certificate from certificate store.
trce: Sign.SignatureProviders.CertificateStore.CertificateStoreService[0]
      Fetched certificate from certificate store. [0.4985 ms]
info: Sign.Core.IDataFormatSigner[0]
      Signing C:\Temp\7\whlkhfbq.w00\Application.app.
trce: Sign.Core.IDataFormatSigner[0]
      Getting SIP Data
trce: Sign.Core.IDataFormatSigner[0]
      Calling SignerSignEx3
fail: Sign.Core.IDataFormatSigner[0]
      Signing failed with error -2146762749.
info: Sign.Core.IDataFormatSigner[0]
      Performing attempt #2 of 3 attempts after 5 s.
info: Sign.Core.IDataFormatSigner[0]
      Signing C:\Temp\7\whlkhfbq.w00\Application.app.
trce: Sign.Core.IDataFormatSigner[0]
      Getting SIP Data
trce: Sign.Core.IDataFormatSigner[0]
      Calling SignerSignEx3
fail: Sign.Core.IDataFormatSigner[0]
      Signing failed with error -2146762749.
info: Sign.Core.IDataFormatSigner[0]
      Performing attempt #3 of 3 attempts after 11.1803398 s.
info: Sign.Core.IDataFormatSigner[0]
      Signing C:\Temp\7\whlkhfbq.w00\Application.app.
trce: Sign.Core.IDataFormatSigner[0]
      Getting SIP Data
trce: Sign.Core.IDataFormatSigner[0]
      Calling SignerSignEx3
fail: Sign.Core.IDataFormatSigner[0]
      Signing failed with error -2146762749.
fail: Sign.Core.IDataFormatSigner[0]
      Failed to sign. Attempts exceeded.
[...]

Troubleshooting If I commented out the ".app" in the supported file extension, it worked as expected https://github.com/dotnet/sign/blob/main/src/Sign.Core/DataFormatSigners/AzureSignToolSigner.cs#L42

Additional context

  • Include the output of sign --version. 0.9.1-beta.25114.1+19225403322754ee9177011e5082d6444368e5cf
  • Include the output of dotnet --info.
.NET SDK:
 Version:           9.0.102
 Commit:            cb83cd4923
 Workload version:  9.0.100-manifests.4a54b1a6
 MSBuild version:   17.12.18+ed8c6aec5

Runtime Environment:
 OS Name:     Windows
 OS Version:  10.0.22631
 OS Platform: Windows
 RID:         win-x64
 Base Path:   C:\Program Files\dotnet\sdk\9.0.102\

.NET workloads installed:
There are no installed workloads to display.
Configured to use loose manifests when installing new manifests.

Host:
  Version:      9.0.1
  Architecture: x64
  Commit:       c8acea2262

.NET SDKs installed:
  8.0.406 [C:\Program Files\dotnet\sdk]
  9.0.102 [C:\Program Files\dotnet\sdk]

.NET runtimes installed:
  Microsoft.AspNetCore.App 8.0.12 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 8.0.13 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 9.0.1 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 8.0.12 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 8.0.13 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 9.0.1 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.WindowsDesktop.App 8.0.12 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 8.0.13 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 9.0.1 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]

Other architectures found:
  x86   [C:\Program Files (x86)\dotnet]
    registered at [HKLM\SOFTWARE\dotnet\Setup\InstalledVersions\x86\InstallLocation]

Environment variables:
  Not set

global.json file:
  Not found

Learn more:
  https://aka.ms/dotnet/info

Download .NET:
  https://aka.ms/dotnet/download

StGabriel avatar Mar 03 '25 16:03 StGabriel

Why the .app is part of the supported file extensions in the AzureSignTool and why the VSIX signing tries to use the AzureSignTool for content within VSIX package?

StGabriel avatar Mar 03 '25 16:03 StGabriel

@StGabriel, the .app file extension is for Dynamics Business Central App files. Support was added via https://github.com/dotnet/sign/pull/652.

The design of Sign CLI is to sign files inside-out: inner files first, then outer files. That's why it's trying to sign an .app file inside your VSIX.

The issue is that the detection of a Dynamics Business Central App file is too simple. We should improve detection of Dynamics Business Central App files so that it doesn't fail in your case.

dtivel avatar Apr 01 '25 22:04 dtivel

@StGabriel, this should be fixed in 0.9.1-beta.25224.2.

dtivel avatar Apr 24 '25 22:04 dtivel