Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the difference between <COM Reference> and <Reference> in .csproj?

Tags:

c#

.net

csproj

I have 2 types of refences and each of them are working fine.

I tried to use each one and got the same result in project build .

Please explain to me what is the difference between COM Reference and Reference.

Thank you.

like image 695
Avi Rubin Avatar asked Jan 26 '23 08:01

Avi Rubin


1 Answers

COM references are used to reference "legacy" COM libraries (COM is the framework used to connect components before .NET). "References" are used to reference .NET libraries (assemblies).

.NET assemblies can also be COM libraries (meaning there are COM-visible classes in the assembly, and the builder generates the necessary metadata to make the assembly COM-visible), but if possible they should be referenced directly rather then by using COM.

So it's possible that the library you are referencing is both a .NET library and a COM library, but how you connect it to your app is different based on how you reference it.

like image 112
D Stanley Avatar answered Jan 28 '23 13:01

D Stanley