dotnet / dotnet/arcade

Arcade targets override AssemblyOriginatorKeyFile

Open
#2,321 16 comments 0 reactions 0 assignees View on GitHub
Dominant language
C#
Stars
729
Forks
397
Avg merge
3d 15m
Merged PRs (30d)
149

Description

When using arcade to publish a project that sets `AssemblyOriginatorKeyFile`, `StrongName.targets` overrides the key file (because arcade imports set a default value for `StrongNameKeyId`): https://github.com/dotnet/arcade/blob/9800953d3b420fd7f81d88c5332df6d1c38e875e/src/Microsoft.DotNet.Arcade.Sdk/tools/StrongName.targets#L35

I believe `StrongName.targets` should not be setting properties as this violates the convention that static properties are computed in props files. Maybe this logic should be moved to `StrongName.props`, which would allow my project's setting of `AssemblyOriginatorKeyFile` to take precedence.

I can work around this by:
- setting `StrongNameKeyId` in my project to some unknown string, preventing arcade's override, and
- setting `PublicKey` and `PublicKeyToken` to some unknown string to satisfy the check in https://github.com/dotnet/arcade/blob/9800953d3b420fd7f81d88c5332df6d1c38e875e/src/Microsoft.DotNet.Arcade.Sdk/tools/StrongName.targets#L84-L85

~~I may have missed something, but I couldn't find any place where `PublicKey` or `PublicKeyToken` were actually used, so I think those shouldn't be required to be set in the first place.~~ edit: they're used in the arcade `InternalsVisibleTo` generator - see below.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.