compile both dll and exe

how can i set up vb.net to create both a dll AND exe on the same compile and then also have the install project recognize both dll and exe and register (with COM) the dll on install at the users computer not only is it a pain to continually switch between the two types of projects for each update, but also a pain to maintain two install packages.

thanks



Answer this question

compile both dll and exe

  • Bfundy

    This what a solution is. A solution consists of may projects. To compile a dll with you project simply add the dll project to your solution. Be sure to set to identity the application as the Startup project in the solution explorer.

    Why are you doing this as COM

    Aslo did you know there is a component in VS2005 that will pack dlls into the excutable itself



  • Will Merydith

    Hope this helps:

    Open up your EXE file in VB

    In the file menu, under ADD, click EXISTING PROJECT

    Open your DLL

    Now when you compile, it compiles both the DLL and the EXE

    Also: When you publish the EXE, VB is clever enough to realize the DLL is required, and it adds this to the installer. Therefore, you only need one installer!



  • Jose Francisco Ruiz Gualda

    Hi, Daniel,

    If, by distribution project, you mean a setup project, then you only need one of those regardless. Simply add the project outputs of both projects to the setup project, and you've only got one install to maintain. (And actually, if you've got a dependency set up between the projects, you really only need to add the project outputs of the primary project, and any required references, such as the DLL, should be picked up.) Similarly, when building the primary app, the DLL will also be rebuilt if anything has changed in it, assuming the one references the other.

    For the other half of your question: each project is designed to build to just one binary for a given configuration. This is actually the point of having class library DLLs, in that common code is abstracted away to a separate location (i.e., project, in this case) which can be referenced by other applications.

    Hope this clears things up,

    --Matt--*



  • HSBF Lewe

    thanks for all your responses, but i guess i am not explaining myself correctly. i want to have ONE set of source files compiled into a dll and exe at the same time. if i have two projects, then i have two copies of the SAME source code. this is not what i want. i only want ONE copy of the source code, that is compiled into an exe and dll. i have tried to create two projects and point one to the other by using shortcuts, but this doesn't work because visual studio will resolve the shortcuts and physically copy the files to the second project folder. i have tried to have two projects in one folder, and this does not work either because of the "My Project" folder and the fact that VS tries to do many things behind the scenes and both projects get screwed up.

    the point of this question is, how do i have ONE set of source files compiled into a dll and an exe at the same time, and then have my one "setup" project install both the dll and the exe i can do each one individually by manually changing the properties of the project, but then i do not know how to include both in the setup project (and one will overwrite the other on compile, anyway).


  • HedleySohn

    Hi, Daniel,

    There is no easy way to do that, other than building one by default and then launching a post-process call to build the other via calling VBC.EXE (see the "Build Events..." button on the Compile tab in the projects's properties) -- it's one build type per project, and each project keeps its own set of files. For cases where two binaries share functionality (either in total or as a subset), the way to go is to have the shared code be in a separate class library, with both projects consuming that class library as a dependency, rather than them sharing source files.

    --Matt--*



  • azbwilcox

    thank you so much for your reply. what i would like to do is have is ONE project compiled to both dll and exe at the same time. then the distribution project within the same solution should install both the exe and dll at the same time, and register (with COM) the dll. this way i would only need to have one copy of my source code, and one distribution project.

    thanks


  • compile both dll and exe