-3

My goal is to build a dll from the command line since I do not have visual studio installed.

So far, I have created a class file named AuthenticatedProxy.cs and went to the command line and ran the following command:

C:\Windows\Microsoft.NET\Framework\v3.5\csc.exe C:\AuthenticatedProxy.cs

The output is an error saying: 'AuthenticatedProxy.exe' does not contain a static 'Main' method suitable for an entry point. (Note that my class file does not have a main method)

How do I compile a class file into a dll? Do I have the correct command?

Dip
  • 343
  • 7
  • 22
  • as a beginner you should get an IDE like VS to do this for you. When you are good enough you can switch to the command line version for the build machine. Don't reinvent the wheel – Steve Feb 05 '18 at 22:04
  • @Steve Unfortunately, I am not able to obtain IDE due to obstacles I am encountered with. – Dip Feb 05 '18 at 22:09

3 Answers3

2

To tell the compiler to build a DLL instead of an EXE, pass -target:library.

Documentation

SLaks
  • 868,454
  • 176
  • 1,908
  • 1,964
1

Using command line is a good practice for every developer.

You may use -target flag:

C:\Windows\Microsoft.NET\Framework\v3.5\csc.exe -target:library C:\AuthenticatedProxy.cs
Boris Modylevsky
  • 3,029
  • 1
  • 26
  • 42
0

every PE(portable executable) must have entry point to initial the exe .

for net platform put below code on your main class

[STAThread]
        private static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(new Form1());
        }

then use

>csc.exe /t:exe AuthenticatedProxy.cs or 
>csc.exe /t:winexe AuthenticatedProxy.cs

for library no need entry point if don't have initiator, only use below cmd

> csc.exe /t:library AuthenticatedProxy.cs

or

build module

>csc.exe /t:module AuthenticatedProxy.cs
Adhit
  • 1
  • 1