Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

InternalsVisibleTo causes CS0246 error: The Type or Namespace could not be found

I am trying to enable one assembly to access another assembly's internal classes by adding

[assembly:InternalsVisibleTo("assembly-name")]

to the second assembly. However, this causes the following error:

error CS0246: The type or namespace name 'InternalsVisibleTo' could not be found (are you missing a using directive or an assembly reference?)

I am following the examples here: MSDN Reference

What am I doing wrong?

like image 711
Tim Avatar asked Dec 14 '22 03:12

Tim


1 Answers

Make sure you import System.Runtime.CompilerServices. Or use a fully qualified name.

[assembly:System.Runtime.CompilerServices.InternalsVisibleTo("assembly-name")]
like image 81
JaredPar Avatar answered Dec 16 '22 17:12

JaredPar