[GH-ISSUE #28] Friend assembly references are not updated with new keys. #24

Closed
opened 2026-02-25 21:30:29 +03:00 by kerem · 3 comments
Owner

Originally created by @loicmorvan on GitHub (Jan 6, 2017).
Original GitHub issue: https://github.com/brutaldev/StrongNameSigner/issues/28

As you may know, when declaring a friend assembly with the attribute InternalsVisibleTo, the public key of the friend assembly must be provided.

When signing assemblies with StrongNameSigner, the tool updates references very well, except these InternalsVisibleTo which then reference unsigned versions of the friend assemblies.

This leads to errors at loading.

Can you make the tool manage these cases?
Thanks!

Originally created by @loicmorvan on GitHub (Jan 6, 2017). Original GitHub issue: https://github.com/brutaldev/StrongNameSigner/issues/28 As you may know, when declaring a friend assembly with the attribute `InternalsVisibleTo`, the public key of the friend assembly must be provided. When signing assemblies with StrongNameSigner, the tool updates references very well, except these `InternalsVisibleTo` which then reference unsigned versions of the friend assemblies. This leads to errors at loading. Can you make the tool manage these cases? Thanks!
kerem 2026-02-25 21:30:29 +03:00
  • closed this issue
  • added the
    invalid
    label
Author
Owner

@brutaldev commented on GitHub (Jan 6, 2017):

InternalsVisibleTo are also corrected or removed (since v1.4.4) depending on whether the dependencies can be found. I suspect you are signing separately and not including all the assemblies you want to fix as a group.

Make sure you are using the latest version and providing all the assemblies you want to fix at the same time instead of trying to sign each one individually. If assemblies are left with InternalsVisibleTo pointing to assemblies that are not signed you will get loading errors. Refer to Dealing with Dependencies for how to include all the related assemblies in one batch.

<!-- gh-comment-id:270881955 --> @brutaldev commented on GitHub (Jan 6, 2017): `InternalsVisibleTo` are also corrected or removed (since v1.4.4) depending on whether the dependencies can be found. I suspect you are signing separately and not including all the assemblies you want to fix as a group. Make sure you are using the latest version and providing all the assemblies you want to fix at the same time instead of trying to sign each one individually. If assemblies are left with `InternalsVisibleTo` pointing to assemblies that are not signed you will get loading errors. Refer to [Dealing with Dependencies](https://github.com/brutaldev/StrongNameSigner#dealing-with-dependencies) for how to include all the related assemblies in one batch.
Author
Owner

@loicmorvan commented on GitHub (Jan 6, 2017):

I sign an entire folder with the command line tool and the option '-in'. The version of StrongNameSigner installed is the latest.
I will triple check and try to reproduce what I said in order to give material.

<!-- gh-comment-id:270883733 --> @loicmorvan commented on GitHub (Jan 6, 2017): I sign an entire folder with the command line tool and the option '-in'. The version of StrongNameSigner installed is the latest. I will triple check and try to reproduce what I said in order to give material.
Author
Owner

@brutaldev commented on GitHub (Jan 6, 2017):

For reference, InternalsVisibleTo attributes are updated on line 309 of the signing helper.

I've just re-enabled the unit tests locally for the fix method to include the public key in the attribute and verified it also works by inspecting with Reflector/ILDasm. The test assemblies have attribute stubs to verify this quite easily already.

If you can produce a sample project where you believe the fixes are not being applied correctly I can help debug it.

<!-- gh-comment-id:270891825 --> @brutaldev commented on GitHub (Jan 6, 2017): For reference, `InternalsVisibleTo` attributes are updated on line [309](https://github.com/brutaldev/StrongNameSigner/blob/260f41a8e6502c08e2f6989ed1bf39a0e08aa956/src/Brutal.Dev.StrongNameSigner/SigningHelper.cs#L309) of the signing helper. I've just re-enabled the unit tests locally for the fix method to include the public key in the attribute and verified it also works by inspecting with Reflector/ILDasm. The test assemblies have [attribute stubs](https://github.com/brutaldev/StrongNameSigner/blob/482dbb56e1e503b634fca2cd9a06c8eb21342f2a/src/Brutal.Dev.StrongNameSigner.TestAssembly.B/Properties/AssemblyInfo.cs#L38) to verify this quite easily already. If you can produce a sample project where you believe the fixes are not being applied correctly I can help debug it.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/StrongNameSigner#24
No description provided.