I have an Mvc application, and I have this option:
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
I do not know what this can do, is a security settings?
When to select ComVisible(false) and when ComVisible(true)?
I search for for Com components, to understand what this is, and I found this definition:
Component Object Model (COM) is a binary-interface standard for software components introduced by Microsoft in 1993. It is used to enable inter-process communication and dynamic object creation in a large range of programming languages. COM is the basis for several other Microsoft technologies and frameworks, including OLE, OLE Automation, ActiveX, COM+, DCOM, the Windows shell, DirectX, UMDF and Windows Runtime.
What this means for me is, that Com components is a way to communicate between applications, but I am not sure that my understanding of this definition is the rigth one.
Can you tell me in simple words(example), why and when should I make ComVisible(true)?
You set the ComVisible property to true, when you need to expose public methods and functions in your assembly to other applications not written in .NET, which can then use the functionality in your assembly using Microsoft's COM, a standardized interface that binds to components at runtime.
Further reading: https://blogs.msdn.microsoft.com/cristib/2012/10/31/how-com-works-how-to-build-a-com-visible-dll-in-c-net-call-it-from-vba-and-select-the-proper-classinterface-autodispatch-autodual-part12
Example: https://richnewman.wordpress.com/2007/04/15/a-beginner%E2%80%99s-guide-to-calling-a-net-library-from-excel
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With