InternalsVisibleTo not working for Managed C++

I found the answer to this. C++ works differently than the other languages. In addition to the InternalsVisibleTo, you must reference assembly A with the as_friend keyword. Since as_friend is not an option in the Add References dialog, you cannot add a project reference, instead, you need to add a reference in each CPP file that you needs it.

#using <A.dll> as_friend

You then also need to change your assembly search path to include the build directory of project A.

IMHO, this is broken and typical of managed C++ being a second class language. Without the ability to do project references, you end up referencing the assembly in the build debug or release directory. This breaks dependencies and the only way you can get it to reference the correct DLL when you change your configuration from debug to release is with ugly #IFDEF DEBUG and relative paths for the #using.

I was also disappointed that this wasn't mentioned in the InternalsVisibleToAttribute documentation. I needed to dig around in the C++ documentation to find the information.

Edit: The documentation for InternalsVisisbleTo has since been updated with a link to the Friend Assemblies (C++) document.