InternalsVisibleTo does not work

Cemre Mengü picture Cemre Mengü · Sep 17, 2013 · Viewed 55.9k times · Source

I insert the line:

[assembly: InternalsVisibleTo("MyTests")]

inside my project under test( Properties/AssemblyInfo.cs) where MyTests is the name of the Unit Test project. But for some reason I still cannot access the internal methods from the unit test project.

Any ideas about what I am doing wrong ?

Answer

Joe picture Joe · Sep 17, 2013

If your assembly is signed with a strong name look at this answer.

Otherwise check that the name of your test assembly really is "MyTests.dll" (it doesn't have to match the project name, though it will by default).