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. C# Class Library and VS.NET standard

C# Class Library and VS.NET standard

Scheduled Pinned Locked Moved C#
csharpvisual-studiohelptutorialquestion
11 Posts 6 Posters 0 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.
  • E ewan

    Hi All, Could anybody point me in the right direction of how to create a class library using C#.NET 2002 standard edition? As it does not have a project template for creating a class library I am finding it difficult to find the right incantation. Any help would be appreciated? (I am assuming this is actually possible.... ;-) ) Cheers, Ewan.

    B Offline
    B Offline
    Blake Coverett
    wrote on last edited by
    #2

    Step 1) Run notepad. Step 2) Type: class MyLibrary { public void Foo() {} } Step 3) Save file as "MyLibrary.cs" Step 4) Compile with: csc /t:library MyLibrary.cs Presto, you have a class library in MyLibrary.dll, add it as a reference, call it from anywhere, all that good stuff. (I'm sure someone else will come along and tell you which buttons to push and checkboxes to change.) -Blake

    E 1 Reply Last reply
    0
    • B Blake Coverett

      Step 1) Run notepad. Step 2) Type: class MyLibrary { public void Foo() {} } Step 3) Save file as "MyLibrary.cs" Step 4) Compile with: csc /t:library MyLibrary.cs Presto, you have a class library in MyLibrary.dll, add it as a reference, call it from anywhere, all that good stuff. (I'm sure someone else will come along and tell you which buttons to push and checkboxes to change.) -Blake

      E Offline
      E Offline
      ewan
      wrote on last edited by
      #3

      Thanks, Not really answering the question I asked tho: How do I create it in VS.NET 2002. Not notepad? I.e. where is the setting where I tell the IDE that I want the command line compile option /t:library Thanks, Ewan.

      B 1 Reply Last reply
      0
      • E ewan

        Thanks, Not really answering the question I asked tho: How do I create it in VS.NET 2002. Not notepad? I.e. where is the setting where I tell the IDE that I want the command line compile option /t:library Thanks, Ewan.

        B Offline
        B Offline
        Blake Coverett
        wrote on last edited by
        #4

        ewan wrote: Not really answering the question I asked tho I know. I'm one of those crotchety old farts who thinks relying on templates and wizards and such weakens the mind. The "VS.NET IDE issues" forum is five lines down. I don't tease people there. ;) -Blake

        E J 2 Replies Last reply
        0
        • B Blake Coverett

          ewan wrote: Not really answering the question I asked tho I know. I'm one of those crotchety old farts who thinks relying on templates and wizards and such weakens the mind. The "VS.NET IDE issues" forum is five lines down. I don't tease people there. ;) -Blake

          E Offline
          E Offline
          ewan
          wrote on last edited by
          #5

          Hehehe No problem. Can't say I blame you ;-) Am very new to .NET environment having done lots in VC++ 6. Can't say the transition is going well ;-) Ta Ewan.

          H 1 Reply Last reply
          0
          • B Blake Coverett

            ewan wrote: Not really answering the question I asked tho I know. I'm one of those crotchety old farts who thinks relying on templates and wizards and such weakens the mind. The "VS.NET IDE issues" forum is five lines down. I don't tease people there. ;) -Blake

            J Offline
            J Offline
            J Dunlap
            wrote on last edited by
            #6

            Blake Coverett wrote: crotchety old farts who thinks relying on templates and wizards and such weakens the mind My take is that you should do it the "hard way" at least a few times so that you know what's going on under the surface, and then save yourself some time by doing it the easy way. ;)

            **"Be not overcome with evil, but overcome evil with good." -- Romans 12:21

            FLUID UI Toolkit | FloodFill in C# & GDI+**

            K 1 Reply Last reply
            0
            • E ewan

              Hehehe No problem. Can't say I blame you ;-) Am very new to .NET environment having done lots in VC++ 6. Can't say the transition is going well ;-) Ta Ewan.

              H Offline
              H Offline
              Heath Stewart
              wrote on last edited by
              #7

              While I'm with Blake on this one, I will tell you that C# projects actually come in two varieties: ASP.NET and not. For the "not", you can easily change the target type by right-clicking on the project and selecting "Class Library". Don't forget to the read the documentation and explore a little, otherwise you'll never amount to anything more than a code monkey. Would you spends thousands of $$$ at a university without cracking a book, or take-off in a brand new jet without reading the product instructions and features? Why do so with a framework or IDE (remember, VS.NET is just a development environment). And exploration is also important - if people didn't explore all 6 billion of us would be stuck around Iran and Iraq were humanity apparently started and we be as dumb as al Qa...er, rocks!

              -----BEGIN GEEK CODE BLOCK----- Version: 3.21 GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++ -----END GEEK CODE BLOCK-----

              E 1 Reply Last reply
              0
              • H Heath Stewart

                While I'm with Blake on this one, I will tell you that C# projects actually come in two varieties: ASP.NET and not. For the "not", you can easily change the target type by right-clicking on the project and selecting "Class Library". Don't forget to the read the documentation and explore a little, otherwise you'll never amount to anything more than a code monkey. Would you spends thousands of $$$ at a university without cracking a book, or take-off in a brand new jet without reading the product instructions and features? Why do so with a framework or IDE (remember, VS.NET is just a development environment). And exploration is also important - if people didn't explore all 6 billion of us would be stuck around Iran and Iraq were humanity apparently started and we be as dumb as al Qa...er, rocks!

                -----BEGIN GEEK CODE BLOCK----- Version: 3.21 GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++ -----END GEEK CODE BLOCK-----

                E Offline
                E Offline
                ewan
                wrote on last edited by
                #8

                I think you are slightly missing the point. Personally when I approach a problem and find a stumbling block I do the following: 1) Read the documentation. 2) If the answer isn't forthcoming (as it really isn't in this case) (oh and your answer is plain wrong btw for the standard edition) ask someone who likely has far more knowledge than I will every have on the subject. Result.... almost immediate answer (plus obligatory flaming). I've coded in c++ for many years and while I am certainly a code monkey at heart I would like to think I do amount to something ;-) . Just because I'm trying to expand my knowledge in the form of c# shouldn't mean I have to read the entire MSDN before I'm entitled to ask questions. Ewan.

                H 1 Reply Last reply
                0
                • E ewan

                  I think you are slightly missing the point. Personally when I approach a problem and find a stumbling block I do the following: 1) Read the documentation. 2) If the answer isn't forthcoming (as it really isn't in this case) (oh and your answer is plain wrong btw for the standard edition) ask someone who likely has far more knowledge than I will every have on the subject. Result.... almost immediate answer (plus obligatory flaming). I've coded in c++ for many years and while I am certainly a code monkey at heart I would like to think I do amount to something ;-) . Just because I'm trying to expand my knowledge in the form of c# shouldn't mean I have to read the entire MSDN before I'm entitled to ask questions. Ewan.

                  H Offline
                  H Offline
                  Heath Stewart
                  wrote on last edited by
                  #9

                  Sorry, "right-click on the project, select properties, and select "Class Library". Should be obvious since it's consistent with everything else in Windows, and I was able to find it in the MSDN Library in under a minute by following a natural chain of topics, like ".NET Development"/"Visual Studio .NET"/"Product Documentation"/ etc. Besides, "coding" does not make a developer. Good research skills are important. And while forums like this are here to help, even exploration of the UI at the very least should've uncovered this. You're right, sometimes the documentation isn't so obvious, but by exploring you certainly learn a lot more. And while some will read the MSDN Library thoroughly, at least exploring the topics covered is better than not - especially the .NET Class Library reference. So, do you get my point?

                  -----BEGIN GEEK CODE BLOCK----- Version: 3.21 GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++ -----END GEEK CODE BLOCK-----

                  1 Reply Last reply
                  0
                  • J J Dunlap

                    Blake Coverett wrote: crotchety old farts who thinks relying on templates and wizards and such weakens the mind My take is that you should do it the "hard way" at least a few times so that you know what's going on under the surface, and then save yourself some time by doing it the easy way. ;)

                    **"Be not overcome with evil, but overcome evil with good." -- Romans 12:21

                    FLUID UI Toolkit | FloodFill in C# & GDI+**

                    K Offline
                    K Offline
                    Kevin McFarlane
                    wrote on last edited by
                    #10

                    I agree. Or if you don't try the hard way once, at least try and get some understanding of what the Wizard has done. Kevin

                    1 Reply Last reply
                    0
                    • E ewan

                      Hi All, Could anybody point me in the right direction of how to create a class library using C#.NET 2002 standard edition? As it does not have a project template for creating a class library I am finding it difficult to find the right incantation. Any help would be appreciated? (I am assuming this is actually possible.... ;-) ) Cheers, Ewan.

                      J Offline
                      J Offline
                      John Arlen
                      wrote on last edited by
                      #11
                      1. Create a new Windows Application Project 2) Right-click the project in Solution Explorer 3) Select Properties 4) In General -> Change Output Type from Web Application to Class Library This will build a DLL. Now you can remove the Form1.cs if desired, and add classes. Edit: Hmm... didn't see the dozen responses before I replied. Oh well.
                      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