Hou to dll in Visual Studio without using console?
-
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.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.
-
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.
-
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?
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.
-
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.
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.
-
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?
yes its possible, the terminology may sound a bit confusing but its easy... see my comment to luc
-
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?
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).
-
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.
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.
-
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).
well the concept of a solution is meant to contain multiple projects... and that is the way its meant to be used...
-
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.
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)
-
well the concept of a solution is meant to contain multiple projects... and that is the way its meant to be used...
Yeeesss... isn't that kinda what I said?
-
Yeeesss... isn't that kinda what I said?
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
-
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)
-
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
Yeeesss... isn't that kinda what I said?
-
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?
yes, but they can be in the same solution
-
yes, but they can be in the same solution
-
and that's what I am saying... They can exist inside the same solution, but not inside the same project.
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)