Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Hou to dll in Visual Studio without using console?

Hou to dll in Visual Studio without using console?

Scheduled Pinned Locked Moved C#
csharpvisual-studioquestioncomtutorial
17 Posts 4 Posters 1 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • N nstk

    I did the following example from msdn C:\Windows\Microsoft.NET\Framework64\v4.0.30319\csc /target:library /out:MathLibrary.DLL Add.cs Mult.cs csc /out:TestCode.exe /reference:MathLibrary.DLL TestCode.cs http://msdn.microsoft.com/en-us/library/3707x96z(v=vs.80).aspx but how do I do the same thing in GUI of VS? Like having 2 files building a dll and then an exe linked to it? Thanks.

    L Offline
    L Offline
    Luc Pattyn
    wrote on last edited by
    #2

    In Visual Studio you can: 1. create a new project using one of the templates; the "Class Library" one would result in a DLL file. 2. modify the type of an existing project using the project properties (right-click the project in the solution pane), then change the output type. Once you have a project that generates a DLL, you would need a second project (e.g. a WinForm or Console one) that can use the DLL (add a reference!). :)

    Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum

    Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.

    N 1 Reply Last reply
    0
    • L Luc Pattyn

      In Visual Studio you can: 1. create a new project using one of the templates; the "Class Library" one would result in a DLL file. 2. modify the type of an existing project using the project properties (right-click the project in the solution pane), then change the output type. Once you have a project that generates a DLL, you would need a second project (e.g. a WinForm or Console one) that can use the DLL (add a reference!). :)

      Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum

      Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.

      N Offline
      N Offline
      nstk
      wrote on last edited by
      #3

      Isn't it possible to have everything in one project and with one button let it build first all the Dlls and then the depended exe? Maybe by putting several projects in a workspace?

      L A P 3 Replies Last reply
      0
      • N nstk

        Isn't it possible to have everything in one project and with one button let it build first all the Dlls and then the depended exe? Maybe by putting several projects in a workspace?

        L Offline
        L Offline
        Luc Pattyn
        wrote on last edited by
        #4

        No it isn't. One project, one DLL/EXE output file. However you can have several projects in one solution (SLN file). :)

        Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum

        Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.

        A 1 Reply Last reply
        0
        • L Luc Pattyn

          No it isn't. One project, one DLL/EXE output file. However you can have several projects in one solution (SLN file). :)

          Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum

          Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.

          A Offline
          A Offline
          Albert Holguin
          wrote on last edited by
          #5

          this may confuse the person asking the question... if you want to build a solution with multiple projects (i.e. to build all with one click), its easily done in studio, just create a master solution and pull in the project files from the related projects.

          N 1 Reply Last reply
          0
          • N nstk

            Isn't it possible to have everything in one project and with one button let it build first all the Dlls and then the depended exe? Maybe by putting several projects in a workspace?

            A Offline
            A Offline
            Albert Holguin
            wrote on last edited by
            #6

            yes its possible, the terminology may sound a bit confusing but its easy... see my comment to luc

            1 Reply Last reply
            0
            • N nstk

              Isn't it possible to have everything in one project and with one button let it build first all the Dlls and then the depended exe? Maybe by putting several projects in a workspace?

              P Offline
              P Offline
              PIEBALDconsult
              wrote on last edited by
              #7

              You could, but that's not how it's intended to be used. My first thought on how to do it would be to use a pre- or post-build event. As luc said -- each project in a solution is intended to produce one executable (EXE or DLL).

              A 1 Reply Last reply
              0
              • A Albert Holguin

                this may confuse the person asking the question... if you want to build a solution with multiple projects (i.e. to build all with one click), its easily done in studio, just create a master solution and pull in the project files from the related projects.

                N Offline
                N Offline
                nstk
                wrote on last edited by
                #8

                I think I got it right. As I understood it I have to pull in whole projects, not only files. Considering the above example of Ms, I created a solution and then 2 projects in it, one with the Mult.cs and Add.cs files which generates the dll and another with the contents of TestCode.cs a bit changed as far as its namespace and the references concerns. Then I changed the starting project and generally I played with some VS commands.

                A 1 Reply Last reply
                0
                • P PIEBALDconsult

                  You could, but that's not how it's intended to be used. My first thought on how to do it would be to use a pre- or post-build event. As luc said -- each project in a solution is intended to produce one executable (EXE or DLL).

                  A Offline
                  A Offline
                  Albert Holguin
                  wrote on last edited by
                  #9

                  well the concept of a solution is meant to contain multiple projects... and that is the way its meant to be used...

                  P 1 Reply Last reply
                  0
                  • N nstk

                    I think I got it right. As I understood it I have to pull in whole projects, not only files. Considering the above example of Ms, I created a solution and then 2 projects in it, one with the Mult.cs and Add.cs files which generates the dll and another with the contents of TestCode.cs a bit changed as far as its namespace and the references concerns. Then I changed the starting project and generally I played with some VS commands.

                    A Offline
                    A Offline
                    Albert Holguin
                    wrote on last edited by
                    #10

                    you have to pull in entire projects because that's the only way you'll get the project specific settings and options (such as linker options for each project)

                    N 1 Reply Last reply
                    0
                    • A Albert Holguin

                      well the concept of a solution is meant to contain multiple projects... and that is the way its meant to be used...

                      P Offline
                      P Offline
                      PIEBALDconsult
                      wrote on last edited by
                      #11

                      Yeeesss... isn't that kinda what I said?

                      A 1 Reply Last reply
                      0
                      • P PIEBALDconsult

                        Yeeesss... isn't that kinda what I said?

                        A Offline
                        A Offline
                        Albert Holguin
                        wrote on last edited by
                        #12

                        i guess you did, but using pre and post build events for building multiple projects in not a good approach, should be one solution with multiple projects

                        P 1 Reply Last reply
                        0
                        • A Albert Holguin

                          you have to pull in entire projects because that's the only way you'll get the project specific settings and options (such as linker options for each project)

                          N Offline
                          N Offline
                          nstk
                          wrote on last edited by
                          #13

                          Well, not only. I think that the only way to have built a dll and a dependent exe is to put them in different projects. That's what I ment. Isn't it right?

                          A 1 Reply Last reply
                          0
                          • A Albert Holguin

                            i guess you did, but using pre and post build events for building multiple projects in not a good approach, should be one solution with multiple projects

                            P Offline
                            P Offline
                            PIEBALDconsult
                            wrote on last edited by
                            #14

                            Yeeesss... isn't that kinda what I said?

                            1 Reply Last reply
                            0
                            • N nstk

                              Well, not only. I think that the only way to have built a dll and a dependent exe is to put them in different projects. That's what I ment. Isn't it right?

                              A Offline
                              A Offline
                              Albert Holguin
                              wrote on last edited by
                              #15

                              yes, but they can be in the same solution

                              N 1 Reply Last reply
                              0
                              • A Albert Holguin

                                yes, but they can be in the same solution

                                N Offline
                                N Offline
                                nstk
                                wrote on last edited by
                                #16

                                and that's what I am saying... They can exist inside the same solution, but not inside the same project.

                                A 1 Reply Last reply
                                0
                                • N nstk

                                  and that's what I am saying... They can exist inside the same solution, but not inside the same project.

                                  A Offline
                                  A Offline
                                  Albert Holguin
                                  wrote on last edited by
                                  #17

                                  yep... that'll facilitate a lot of other things like building an entire solution with a single click and debugging dll/exe source simultaneously. i have a solution with 26 projects in it (for a large software suite)

                                  1 Reply Last reply
                                  0
                                  Reply
                                  • Reply as topic
                                  Log in to reply
                                  • Oldest to Newest
                                  • Newest to Oldest
                                  • Most Votes


                                  • Login

                                  • Don't have an account? Register

                                  • Login or register to search.
                                  • First post
                                    Last post
                                  0
                                  • Categories
                                  • Recent
                                  • Tags
                                  • Popular
                                  • World
                                  • Users
                                  • Groups