InternalsVisibleTo - Public Key Help Required

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi.
I've strong-named an application using the 'Signing' option in project
properties. Four friend assemblies exist in AssemblyInfo.cs, and look like
this:
[assembly:
InternalsVisibleTo("Microsoft.Practices.EnterpriseLibrary.Logging.Tests")]

After strong-naming the application my friend references are giving the error:
"Friend assembly reference
Microsoft.Practices.EnterpriseLibrary.Logging.Tests is invalid. Strong-name
signed assemblies must specify a public key in their InternalsVisibleTo
declarations."

I understand that I must specify the PublicKey value in the
InternalsVisibleTo declaration. What I DON'T know is how to acquire this.
How to I get the PublicKey value? I've tried running the command "sn -tp
...." from the Visual Studio 2005 Command prompt, but it says it can't find
the file.

How do I get this PublicKey value?

Thanks!
 
How do I get this PublicKey value?

sn -T yourdllname.dll

or

sn -T yourexename.exe


hth
Markus
 
Markus,
The project has not yet been successfully built, and therefore a .dll
doesn't yet exist. How should I proceed in this case?

Thanks for your time.
 
The project has not yet been successfully built, and therefore a .dll
doesn't yet exist. How should I proceed in this case?

Create another project with just on .cs (or .vb) file. Build this and
sign this. Then get the public key from it (it's the same, when signed
with the same key).

Additionally, you might also get the public key from the .snk File. Just
go into the command line and type "sn". Then all the options for sn are
displayed and check for the right flag.

Markus
 
Got it! Thank you!!

Markus said:
Create another project with just on .cs (or .vb) file. Build this and
sign this. Then get the public key from it (it's the same, when signed
with the same key).

Additionally, you might also get the public key from the .snk File. Just
go into the command line and type "sn". Then all the options for sn are
displayed and check for the right flag.

Markus
 
Back
Top