Fix unsigned kiota.exe file when installed as dotnet tool. #5730
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #5650
According to the docs at https://github.com/dotnet/sdk/blob/main/documentation/general/signing-global-tool-packages.md,
a shim is created in target machine by dotnet in scenarios where the
PackAsToolShimRuntimeIdentifiers
tag is not defined in the csproj. This ends up showing as an unsigned binary as it is created at the time of installation.This PR adds as script to dynamically add the attribute so that the shim is created during
dotnet build
in the release pipeline so that it signed together with the artifacts.This has been validated by installing the tool locally as well as inspecting the artifacts in this pipeline run.
https://dev.azure.com/microsoftgraph/Graph%20Developer%20Experiences/_build/results?buildId=169565&view=results
Notes
We could have added this directly to the csproj. However, this causes build errors for the project when we attempt to build/publish the project as an executable with a runtime idenfier and not a dotnet tool. So this script is intended to run only for scenarios where we want to publish the dotnet tool.