Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

C# "Register COM interop" option is disabled

I am trying to create DLL out of my C# code, I found some links that guides me to create my DLL file and use it in Excel as I wanted. One of the steps is to check the "Register COM interop" check box in the Build tab of the project.

Unfortunately, this checkbox is always disabled! Does anyone know how to enable it ? I am using VS 2010.

like image 590
Emo Avatar asked Jun 23 '12 13:06

Emo


People also ask

What C is used for?

C programming language is a machine-independent programming language that is mainly used to create many types of applications and operating systems such as Windows, and other complicated programs such as the Oracle database, Git, Python interpreter, and games and is considered a programming foundation in the process of ...

What is the full name of C?

In the real sense it has no meaning or full form. It was developed by Dennis Ritchie and Ken Thompson at AT&T bell Lab. First, they used to call it as B language then later they made some improvement into it and renamed it as C and its superscript as C++ which was invented by Dr.

Is C language easy?

C is a general-purpose language that most programmers learn before moving on to more complex languages. From Unix and Windows to Tic Tac Toe and Photoshop, several of the most commonly used applications today have been built on C. It is easy to learn because: A simple syntax with only 32 keywords.

What is C in C language?

What is C? C is a general-purpose programming language created by Dennis Ritchie at the Bell Laboratories in 1972. It is a very popular language, despite being old. C is strongly associated with UNIX, as it was developed to write the UNIX operating system.


2 Answers

firstly verify your output type, he must be Class Library and not Console application.

Secondly if your problem persist, open your csproj and modify your node

<RegisterForComInterop>true</RegisterForComInterop>

Screenshot

like image 164
Aghilas Yakoub Avatar answered Oct 16 '22 23:10

Aghilas Yakoub


I had the same problem, with the new Visual Studio 2019. The first choice for creating a Class Library is Class Library .Net framework and this will not work. You have to go down several lines to find Class Library (.NET framework) C# Windows library. This will work, provided that in project property you don't forget in Assembly Information to activate Make assembly copy visible in addition to register for com interop in build

like image 4
Jean-Bernard LePecq Avatar answered Oct 16 '22 21:10

Jean-Bernard LePecq