dotnet / sign

Code Signing CLI tool supporting Authenticode, NuGet, VSIX, and ClickOnce
MIT License
439 stars 84 forks source link

Unable to install #702

Closed bc3tech closed 2 weeks ago

bc3tech commented 2 weeks ago

Describe the bug

Unable to install the sign tool via dotnet install:

> dotnet tool install -g sign
Unhandled exception: System.IO.DirectoryNotFoundException: Could not find a part of the path 'C:\Users\me\.dotnet\tools\.store\sign\1.1.5\sign\1.1.5\tools'.
   at System.IO.Enumeration.FileSystemEnumerator`1.CreateDirectoryHandle(String path, Boolean ignoreNotFound)
   at System.IO.Enumeration.FileSystemEnumerator`1.Init()
   at System.IO.Enumeration.FileSystemEnumerable`1..ctor(String directory, FindTransform transform, EnumerationOptions options, Boolean isNormalized)
   at System.IO.Enumeration.FileSystemEnumerableFactory.UserDirectories(String directory, String expression, EnumerationOptions options)
   at System.IO.Directory.InternalEnumeratePaths(String path, String searchPattern, SearchTarget searchTarget, EnumerationOptions options)
   at System.IO.Directory.GetDirectories(String path, String searchPattern, EnumerationOptions enumerationOptions)
   at Microsoft.DotNet.ToolPackage.ToolPackageInstance..ctor(PackageId id, NuGetVersion version, DirectoryPath packageDirectory, DirectoryPath assetsJsonParentDirectory)
   at Microsoft.DotNet.Cli.ToolPackage.ToolPackageDownloader.<>c__DisplayClass8_0.<InstallPackage>b__0()
   at Microsoft.DotNet.Cli.TransactionalAction.Run[T](Func`1 action, Action commit, Action rollback)
   at Microsoft.DotNet.Tools.Tool.Install.ToolInstallGlobalOrToolPathCommand.<>c__DisplayClass20_0.<Execute>b__1()
   at Microsoft.DotNet.Tools.Tool.Install.ToolInstallGlobalOrToolPathCommand.RunWithHandlingInstallError(Action installAction)
   at Microsoft.DotNet.Tools.Tool.Install.ToolInstallGlobalOrToolPathCommand.Execute()
   at System.CommandLine.Invocation.InvocationPipeline.Invoke(ParseResult parseResult)
   at Microsoft.DotNet.Cli.Program.ProcessArgs(String[] args, TimeSpan startupTime, ITelemetry telemetryClient)

Repro steps

just run dotnet tool install -g sign or dotnet tool install --tool-path ./sign sign

Expected behavior The tool to be installed.

Actual behavior It wasn't.

Additional context

dotnet info ``` > dotnet --info .NET SDK: Version: 8.0.300 Commit: 326f6e68b2 Workload version: 8.0.300-manifests.f086599c MSBuild version: 17.10.4+10fbfbf2e Runtime Environment: OS Name: Windows OS Version: 10.0.26100 OS Platform: Windows RID: win-arm64 Base Path: C:\Program Files\dotnet\sdk\8.0.300\ .NET workloads installed: [aspire] Installation Source: VS 17.11.34929.205 Manifest Version: 8.0.0/8.0.100 Manifest Path: C:\Program Files\dotnet\sdk-manifests\8.0.100\microsoft.net.sdk.aspire\8.0.0\WorkloadManifest.json Install Type: FileBased Host: Version: 8.0.5 Architecture: arm64 Commit: 087e15321b .NET SDKs installed: 3.1.426 [C:\Program Files\dotnet\sdk] 5.0.408 [C:\Program Files\dotnet\sdk] 8.0.300 [C:\Program Files\dotnet\sdk] .NET runtimes installed: Microsoft.AspNetCore.App 3.1.32 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 5.0.17 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 6.0.30 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 7.0.19 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 8.0.5 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.NETCore.App 3.1.32 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 5.0.17 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 6.0.30 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 7.0.19 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 8.0.5 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.WindowsDesktop.App 5.0.17 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 6.0.30 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 7.0.19 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 8.0.5 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Other architectures found: x64 [C:\Program Files\dotnet\x64] registered at [HKLM\SOFTWARE\dotnet\Setup\InstalledVersions\x64\InstallLocation] x86 [C:\Program Files (x86)\dotnet] registered at [HKLM\SOFTWARE\dotnet\Setup\InstalledVersions\x86\InstallLocation] Environment variables: Not set global.json file: Not found ```

Might be worth it to actually put some installation instructions in the README ;)

I installed azuresigntool using dotnet tool install -g in the same terminal session, so I'm pretty sure it's not my dotnet that's broken.

`-v diag` output ``` > dotnet tool install -g sign -v diag [NuGet Manager] [Info] GET https://api.nuget.org/v3/registration5-gz-semver2/sign/index.json [NuGet Manager] [Info] GET https://devdiv.pkgs.visualstudio.com/10e66e43-9645-4201-b128-0fdc3769cc17/_packaging/5759d4c6-786d-48fe-a576-7d95843f90cf/nuget/v3/registrations2-semver2/sign/index.json [NuGet Manager] [Info] OK https://api.nuget.org/v3/registration5-gz-semver2/sign/index.json 462ms [NuGet Manager] [Info] OK https://devdiv.pkgs.visualstudio.com/10e66e43-9645-4201-b128-0fdc3769cc17/_packaging/5759d4c6-786d-48fe-a576-7d95843f90cf/nuget/v3/registrations2-semver2/sign/index.json 400ms [NuGet Manager] [Info] GET https://api.nuget.org/v3/registration5-gz-semver2/sign/index.json [NuGet Manager] [Info] GET https://devdiv.pkgs.visualstudio.com/10e66e43-9645-4201-b128-0fdc3769cc17/_packaging/5759d4c6-786d-48fe-a576-7d95843f90cf/nuget/v3/registrations2-semver2/sign/index.json [NuGet Manager] [Info] OK https://api.nuget.org/v3/registration5-gz-semver2/sign/index.json 81ms [NuGet Manager] [Info] OK https://devdiv.pkgs.visualstudio.com/10e66e43-9645-4201-b128-0fdc3769cc17/_packaging/5759d4c6-786d-48fe-a576-7d95843f90cf/nuget/v3/registrations2-semver2/sign/index.json 227ms [NuGet Manager] [Info] GET https://devdiv.pkgs.visualstudio.com/10e66e43-9645-4201-b128-0fdc3769cc17/_packaging/5759d4c6-786d-48fe-a576-7d95843f90cf/nuget/v3/flat2/sign/index.json [NuGet Manager] [Info] OK https://devdiv.pkgs.visualstudio.com/10e66e43-9645-4201-b128-0fdc3769cc17/_packaging/5759d4c6-786d-48fe-a576-7d95843f90cf/nuget/v3/flat2/sign/index.json 126ms [NuGet Manager] [Info] GET https://devdiv.pkgs.visualstudio.com/10e66e43-9645-4201-b128-0fdc3769cc17/_packaging/5759d4c6-786d-48fe-a576-7d95843f90cf/nuget/v3/flat2/sign/1.1.5/sign.1.1.5.nupkg [NuGet Manager] [Info] OK https://devdiv.pkgs.visualstudio.com/10e66e43-9645-4201-b128-0fdc3769cc17/_packaging/5759d4c6-786d-48fe-a576-7d95843f90cf/nuget/v3/flat2/sign/1.1.5/sign.1.1.5.nupkg 714ms Skipping NuGet package signature verification. Unhandled exception: System.IO.DirectoryNotFoundException: Could not find a part of the path 'C:\Users\me\.dotnet\tools\.store\sign\1.1.5\sign\1.1.5\tools'. at System.IO.Enumeration.FileSystemEnumerator`1.CreateDirectoryHandle(String path, Boolean ignoreNotFound) at System.IO.Enumeration.FileSystemEnumerator`1.Init() at System.IO.Enumeration.FileSystemEnumerable`1..ctor(String directory, FindTransform transform, EnumerationOptions options, Boolean isNormalized) at System.IO.Enumeration.FileSystemEnumerableFactory.UserDirectories(String directory, String expression, EnumerationOptions options) at System.IO.Directory.InternalEnumeratePaths(String path, String searchPattern, SearchTarget searchTarget, EnumerationOptions options) at System.IO.Directory.GetDirectories(String path, String searchPattern, EnumerationOptions enumerationOptions) at Microsoft.DotNet.ToolPackage.ToolPackageInstance..ctor(PackageId id, NuGetVersion version, DirectoryPath packageDirectory, DirectoryPath assetsJsonParentDirectory) at Microsoft.DotNet.Cli.ToolPackage.ToolPackageDownloader.<>c__DisplayClass8_0.b__0() at Microsoft.DotNet.Cli.TransactionalAction.Run[T](Func`1 action, Action commit, Action rollback) at Microsoft.DotNet.Tools.Tool.Install.ToolInstallGlobalOrToolPathCommand.<>c__DisplayClass20_0.b__1() at Microsoft.DotNet.Tools.Tool.Install.ToolInstallGlobalOrToolPathCommand.RunWithHandlingInstallError(Action installAction) at Microsoft.DotNet.Tools.Tool.Install.ToolInstallGlobalOrToolPathCommand.Execute() at System.CommandLine.Invocation.InvocationPipeline.Invoke(ParseResult parseResult) at Microsoft.DotNet.Cli.Program.ProcessArgs(String[] args, TimeSpan startupTime, ITelemetry telemetryClient) ```
It also fails on a GitHub Action when using the exact step shown in the sample, but for a different reason ```yaml - name: Install sign tool run: dotnet tool install --tool-path ./sign sign ``` ``` Run dotnet tool install --tool-path ./sign sign sign is not found in NuGet feeds https://api.nuget.org/v3/index.json, C:\Program Files (x8[6](https://github.com/bc3tech/docgpt/actions/runs/9471351664/job/26094381286#step:4:6))\Microsoft SDKs\NuGetPackages\". Error: Process completed with exit code 1. ```
clairernovotny commented 2 weeks ago

Hi @bc3tech you need to use the prerelease parameter as the 1.1.5 version is unlisted from a prior package. When we release the first non-prerelease version, we will start with a higher version number than the prior packages so installing will work as expected.

For now, if you want to avoid installing a version, this command will work:

dotnet install --tool-path . --prerelease sign

dtivel commented 2 weeks ago

@bc3tech, nuget.org shows the command-line statement you can run to install a specific version of the tool. In this screenshot, nuget.org shows the command to install sign 0.9.1-beta.24312.3 as a global tool. There's another tab (and command) for installing it as a local tool.

image

bc3tech commented 2 weeks ago

Thanks - I've opened #711 after getting it installed.