none
Creating .exe and .dll file RRS feed

Answers

  • Hi Swap,

    When you say a beginner are you saying that the code you are writing is part of your studies? And are you using Visual studio or Notepad. 

    If you are using visual studio then you can Select a class library project for creating a dll that you can refer in other projects or you can select a Console or windows application as per the need to create an exe.

    if you are using notepad to practice then you have to compile the code using csc.exe and while compiling you can specify the parameters to get the output as a dll or as an exe

    • Compiles File.cs producing File.exe:

    csc File.cs 
    • Compiles File.cs producing File.dll:

    csc /target:library File.cs
    • Compiles File.cs and creates My.exe:

    csc /out:My.exe File.cs
    • Compiles all the C# files in the current directory, with optimizations on and defines the DEBUG symbol. The output is File2.exe:

    csc /define:DEBUG /optimize /out:File2.exe *.cs
    • Compiles all the C# files in the current directory producing a debug version of File2.dll. No logo and no warnings are displayed:

    csc /target:library /out:File2.dll /warn:0 /nologo /debug *.cs
    • Compiles all the C# files in the current directory to Something.xyz (a DLL):

    csc /target:library /out:Something.xyz *.cs

    Kindly refer https://msdn.microsoft.com/en-us/library/78f4aasd.aspx


    --------------------------------------------------------

    Surender Singh Bhadauria

    My Blog

     

    Monday, November 2, 2015 6:53 AM
  • Have you tried creating and building a new console application?  This will create an .exe.  It will be located in your bin/Debug or bin/Release folder which are in the same folder as your project.  If you create a class library project it will be a .dll and will be built to a similar place.

    You might be interested in looking at this walkthrough.

    Sunday, November 1, 2015 3:13 PM
  • Note that the internal structure of a .NET .exe and .NET dll are actually quite similar. You can always use either as project reference for another .NET Project. .NET is here quite similar to Java but, this does not apply to many non .NET exe files.
    For stuff like COM interop on both types I am not sure however.

    A .exe is created from any project type where it makes sense:
    Inlcuding WinForms, Console, WPF, UWP and Service projects.

    Dll's are actually a seperate project type.
    You should build a .dll if the intention is a dedicated class libary.
    If you only use the classes in one project, you should just keep it in there.
    If only 1-2 others reference it too, you can just go by referencing the .exe.

    There are also some project types that that produce neither.
    ASP.Net Projects for example will be neither .exe nor .dll

    Sunday, November 1, 2015 5:52 PM
  • http://www.codeproject.com/Articles/36847/Three-Layer-Architecture-in-C-NET

    You do the above tutorial, and you'll do it all in one shot of creating an exe and some DLL(s) that work with the exe. 

    Sunday, November 1, 2015 9:34 PM

All replies

  • Have you tried creating and building a new console application?  This will create an .exe.  It will be located in your bin/Debug or bin/Release folder which are in the same folder as your project.  If you create a class library project it will be a .dll and will be built to a similar place.

    You might be interested in looking at this walkthrough.

    Sunday, November 1, 2015 3:13 PM
  • Note that the internal structure of a .NET .exe and .NET dll are actually quite similar. You can always use either as project reference for another .NET Project. .NET is here quite similar to Java but, this does not apply to many non .NET exe files.
    For stuff like COM interop on both types I am not sure however.

    A .exe is created from any project type where it makes sense:
    Inlcuding WinForms, Console, WPF, UWP and Service projects.

    Dll's are actually a seperate project type.
    You should build a .dll if the intention is a dedicated class libary.
    If you only use the classes in one project, you should just keep it in there.
    If only 1-2 others reference it too, you can just go by referencing the .exe.

    There are also some project types that that produce neither.
    ASP.Net Projects for example will be neither .exe nor .dll

    Sunday, November 1, 2015 5:52 PM
  • http://www.codeproject.com/Articles/36847/Three-Layer-Architecture-in-C-NET

    You do the above tutorial, and you'll do it all in one shot of creating an exe and some DLL(s) that work with the exe. 

    Sunday, November 1, 2015 9:34 PM
  • Hi Swap,

    When you say a beginner are you saying that the code you are writing is part of your studies? And are you using Visual studio or Notepad. 

    If you are using visual studio then you can Select a class library project for creating a dll that you can refer in other projects or you can select a Console or windows application as per the need to create an exe.

    if you are using notepad to practice then you have to compile the code using csc.exe and while compiling you can specify the parameters to get the output as a dll or as an exe

    • Compiles File.cs producing File.exe:

    csc File.cs 
    • Compiles File.cs producing File.dll:

    csc /target:library File.cs
    • Compiles File.cs and creates My.exe:

    csc /out:My.exe File.cs
    • Compiles all the C# files in the current directory, with optimizations on and defines the DEBUG symbol. The output is File2.exe:

    csc /define:DEBUG /optimize /out:File2.exe *.cs
    • Compiles all the C# files in the current directory producing a debug version of File2.dll. No logo and no warnings are displayed:

    csc /target:library /out:File2.dll /warn:0 /nologo /debug *.cs
    • Compiles all the C# files in the current directory to Something.xyz (a DLL):

    csc /target:library /out:Something.xyz *.cs

    Kindly refer https://msdn.microsoft.com/en-us/library/78f4aasd.aspx


    --------------------------------------------------------

    Surender Singh Bhadauria

    My Blog

     

    Monday, November 2, 2015 6:53 AM