After signing an assembly class and exposing the internals to a friend assembly with the InternalsVisibleTo("FriendAssembly,PublicKey= ") attribute, I am getting a 'Set accessor is inaccessible error'. The property is:
public datatype PropertyName { get; internal set; }
I don't want to change the access modifier of the Set accessor.
CodePudding user response:
The [assembly:InternalsVisibleTo...)]
attribute must be in the assembly that contains the internal properties you wish to expose.
If your assembly is strong name signed, then the friend assembly must also be strong name signed and you must use:
[assembly:InternalsVisibleTo("FriendAssembly, PublicKey=...)]
Where the PublicKey part is the full public key from the strong-named key file of the friend assembly.
If your assembly is not signed then use:
[assembly:InternalsVisibleTo("FriendAssembly")]