vcsjones / AzureSignTool

SignTool Library and Azure Key Vault Support
MIT License
272 stars 85 forks source link

Installing Azure Sign Tool failed my builds. #166

Closed ncook-hxgn closed 2 years ago

ncook-hxgn commented 2 years ago

I added a step to my build definition to install the sign tool, as instructed by WALKTHROUGH.md

My Build failed.

I got this error:

Starting: Install Azure SignTool
==============================================================================
Task         : .NET Core
Description  : Build, test, package, or publish a dotnet application, or run a custom dotnet command
Version      : 2.202.0
Author       : Microsoft Corporation
Help         : https://docs.microsoft.com/azure/devops/pipelines/tasks/build/dotnet-core-cli
==============================================================================
C:\Windows\system32\chcp.com 65001
Active code page: 65001
Info: .NET Core SDK/runtime 2.2 and 3.0 are now End of Life(EOL) and have been removed from all hosted agents. If you're using these SDK/runtimes on hosted agents, kindly upgrade to newer versions which are not EOL, or else use UseDotNet task to install the required version.
"C:\Program Files\dotnet\dotnet.exe" tool install --global azuresigntool --add-source https://api.nuget.org/v3/index.json --ignore-failed-sources
Tool 'azuresigntool' is already installed.
##[error]Error: The process 'C:\Program Files\dotnet\dotnet.exe' failed with exit code 1
##[error]Dotnet command failed with non-zero exit code on the following projects : 
Finishing: Install Azure SignTool

How can I use the azure sign tool whilst ensuring that the azure sign tool is already installed without having the installation of azure sign tool fail my build?

ncook-hxgn commented 2 years ago

https://github.com/dotnet/sdk/issues/9043

ididitmyway commented 2 years ago

You can add a condition with a variable isitinstalled and you can check it on your own and then the the variable to false or true.

In my pipeline I add a Parameter to run the installation once on a manual build, and set the default value to false, so it would just try to install it if I mannually force it.

ncook-hxgn commented 2 years ago

To be fair I should close this.

I cloned the repo to my kit, did a dotnet new tool-manifest or something, and that created a json manifest. I committed this file. I then did a dotnet tool install in the pipeline, omitting the --global option, and got the tool installed.

The docs are still not clear about this aspect though. Crash course in dotnet for me, but it works.