Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I use InternalsVisibleTo for C++ managed code?

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?

like image 799
deeptowncitizen Avatar asked Feb 12 '26 20:02

deeptowncitizen


1 Answers

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.

like image 170
JMK Avatar answered Feb 15 '26 10:02

JMK



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!