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
  • 97,193
  • 102
  • 206
  • 364
dr11
  • 5,166
  • 11
  • 35
  • 77

1 Answers1

2

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
  • 27,273
  • 52
  • 163
  • 280