Can one use InternalVisibleTo without strong-named assembly in C#?
Asked Answered
S

1

10

I could not find any clear statement on MSDN regarding this, there are some examples with strong names other are without, for me it seems like it should work even without but its not working.

Thank you

Sumptuary answered 8/5, 2012 at 6:22 Comment(0)
H
16

The documentation is quite explicit:

Both the current assembly and the friend assembly must be unsigned, or both must be signed with a strong name. If they are signed with a strong name, the argument to the InternalsVisibleToAttribute constructor must include the full public key as well as the name of the assembly.

See this answer for an example of what full public key means.

Hoelscher answered 8/5, 2012 at 6:26 Comment(2)
Thank you for the answer, thats what i understood from the documentation too, but still for some reason it isnt working. i know what full public key means but i would prefer to expose the internal methode than integrating public keys in all DLL's i found the option without public keys very helpful concerning unittestsSumptuary
Well, if you don't want to specify the full public key, then both assemblies have to be unsigned. Is that the case? Also be wary that the presence of [AssemblyKeyFile] and [AssemblyKeyName] attributes, even empty, can mess with [InternalsVisibleTo], as this answer reveals.Scrabble

© 2022 - 2024 — McMap. All rights reserved.