i have trouble with building some projects.
please consider this scenario:
- i have 2 projects. for example A and B.
- there is a reference from A to B
- project of B was strongly signed (i did not want it to be signed for some reasons. so i decided to remove it`s checkbox of “sign the assembly”)
-
there was a line of code in
AssemblyInfo.cs file in the A project says:[assembly: InternalsVisibleTo("B,publicKey=0024......")]i changed it to:
[assembly: InternalsVisibleTo("B")]now when i compile one of
these projects, an error has came up and says:
Friend assembly reference ‘B’ is invalid. Strong-name signed assemblies must specify a public key in their InternalsVisibleTo declarations.
my question is here: how does compiler know that it was a signed assembly someday? and how can i completely remove strongly signed from assembly of B and finally build them correctly?
edited:
by the way
please note that both of theme is not strongly signed! because i remove both of those “sign the assembly” checkboxes from those project`s properties
when i changed the name of assembly to the some wrong name like “bla_bla_bla” that does not even exists, the error is the same!
[assembly: InternalsVisibleTo("bla_bla_bla")]
i think that this Theory is true:
in fact B Project does not compiled, and if it does not find the matched compiled project name (when building project A), compiler guess that B project is strongly signed with the public key that developer did not provide it! and at last it will prompt such odd error!
for the reason of B has a reference to A, when i compile B project, it will compile it’s reference first (A project) and again compiler will prompt me that error (as the same as when i comopile project A)
but either it`s not true or some thing is wrong with my project A. because i start two new simple projects from scratch and every thing goes fine with no error (even when i change [assembly:…] statement to the invalid assembly name) i completely crashed
Oh My God! i have to remove this line of code:
[assembly: AssemblyKeyName("")]so that projectA completely forget about signing project and continue it`s easy life
as you know if the destination Assembly was signed so referenced assembly must be signed too. in fact this line of code remind compiler that this project is signed. so… the target assembly should be signed too. therefore compiler complaint about having friend assembly with no ” , publicKey=…” token.