Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Any way to convert class library function into exe?

Tags:

Is there any way to change my class library program into an .exe or a click once-application? It is Currently a dll.

I am able to create a click once app but it is not working after installation.

like image 501
Vysakh Avatar asked Apr 26 '13 12:04

Vysakh


People also ask

How do I change console application to class library?

In the Solutions Explorer window, right-click the exe project and then select Properties in the popup. Then change the Output type from Windows Application to Class Library.

Is a class library a DLL?

The Class Library . DLL contains program code, data, and resources that can be can used by other programs and are easily implemented into other Visual Studio projects.

How do you fix project with an output type of class library Cannot be started directly?

Solution. Right click on the Solution Explorer of your project in the right top corner of the IDE and the select the Properties option located in the dropdown menu. Now from the Solution Property Pages dialog that appears, select the StartUp Project list option.


2 Answers

In the properties of the project -> application tag, change the Output type to console Application. Anyway, you need to create a static Main() method as a starting point.

    static void Main(string[] args)     {     } 
like image 159
Joaquín Ferraz Avatar answered Oct 18 '22 20:10

Joaquín Ferraz


You can change the output type of your project in it's settings, then add a main entrypoint, as others have mentioned (Note, you want "Windows application", not "Console Application" here):

enter image description here

If you can't change the source for some reason, you can create a new very simple application (an .exe), and call public methods in your .dll from it:

namespace YourNamespace {     internal class YourApp     {         private static void Main(string[] args)         {             // Call your function here.          }     } } 

To do this, you just need to include a reference to the existing .dll into this new application.

like image 41
Kjartan Avatar answered Oct 18 '22 20:10

Kjartan