[Mono-list] InternalsVisibleTo - how to use

Abe Gillespie abe.gillespie at gmail.com
Tue Apr 6 13:12:17 EDT 2010

Hmm ... can't seem to get it to work in MD.

This is what I've done:
1.  Added assembly: InternalsVisibleTo("MyTest,
PublicKey=a-bunch-of-hex-chars")] to the granting assembly a la
 Generated a strong name file with "sn -k Tests.snk".
3.  In the Unit Tests project set the Options > Build > Assembly Signing to
point to the Tests.snk file.
4.  Compiled the Unit Tests project first w/o any internal member references
so it gets the strong name.
5.  Add the code to the Unit Test project that references internal members
in the other assembly.

6.  No worky - Error CS0122: `<internal-member>' is inaccessible due to its
protection level (CS0122) (UnitTests)


On Tue, Apr 6, 2010 at 12:49 PM, Robert Jordan <robertj at gmx.net> wrote:

> On 06.04.2010 18:39, Abe Gillespie wrote:
> > What do I need to do to allow the InternalsVisibleTo attribute to work
> for a
> > testing project within MonoDevelop.  (If this is a MD-specific question
> then
> > I'm happy to take the discussion there.)
> Add this attribute to the assembly whose internals should
> be exposed:
> [assembly: InternalsVisibleTo("Assembly.Name.Of.Your.Test.Assembly")]
> If your test assembly is called "Test.dll", the assembly name would
> be "Test".
> MonoDevelop isn't even involved here.
> Robert
> _______________________________________________
> Mono-list maillist  -  Mono-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-list
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/mono-list/attachments/20100406/7fb5ab39/attachment.html 

More information about the Mono-list mailing list