3

I have C++ Managed project. And I'd like to test it with C# Nunit class library. I defined C++ class as

internal ref class SomeClass{};

And how can I make it visible to C# class library?

Soner Gönül
  • 94,086
  • 102
  • 195
  • 339
dr11
  • 4,575
  • 8
  • 33
  • 68

1 Answers1

1

Yes, add the following to AssemblyInfo.cpp:

[assembly: InternalsVisibleTo("C#UnitTestClassLibraryName")]

By the way, InternalsVisibleTo works on the assembly level, so either the entire assembly is visible to the class specified, or none of it is.

Community
  • 1
  • 1
JMK
  • 26,031
  • 51
  • 155
  • 274