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