none
Compiler Questions - C# 2005 Express Edition RRS feed

  • Question

  • Hello, I'm a newbie at this, so I appologize for the remedial-factor.

    I'm building a windows application.  I want 2 files:  1 for the forms (the .exe), 1 for the backend code (the .dll).
    I've pretty much got the coding done, but I'm having trouble getting it to compile properly (I really don't understand how to generate a standard .dll and .exe with the Express edition).

    From what I understand, the .dll file needs to be compiled, then the .exe needs the line: 
    using dllfile;

    But how do I get the Express edition to compile it that way?

    I've seen command line ways to do this, but I'm hoping there's a way to do it in the application, itself.
    Thursday, June 14, 2007 7:43 PM

All replies

  • I am not overly familiar with VS Express capabilities but generally what you are looking for is

    "Creating a Class Library" This is your Support DLL

    Then in your main project you "Add a Reference" and browse to the location of the dll.

     

    Thursday, June 14, 2007 8:03 PM
  • Hi,

    The express edition does not support multiple projects per solution. Each project generate an output, an executable (.exe) or a library (.dll).  A work around is to create 2 solutions the first one with a windows forms application project type and the second with the class library project type. 

    Once the library project is compiled, it will generate a dll and you need to add a reference from the forms project. In the solution explorer, right-click on the References folder under your project and select Add Reference. In the Browse tab, select the dll file.

    Then at the top of the .cs files where you need the code from that you need a class from the library, add using Namespace.Of.The.Library; statement with the namespace you used in the library (the default is the name of the project).

    Regards,
    Charles
    Thursday, June 14, 2007 8:07 PM
  • C# 2005 Express Edition most certainly does support multiple projects per solution.

    To build a Windows Forms executable with a class library do the following in C# EE:

    1) Pick File/New Project and create a Windows Application.

    2) Save the project.

    3) In the Solution Explorer, right-click on the solution, select Add, and choose "New Project..."  Create a Class Library.

    4) Again in the Solution Explorer, expand the Windows Application, right-click on References, and select "Add Reference..."  Click on the Projects tab and select the Class Library project.

    Now whenever you build the solution, the IDE will build the class library DLL (in its project's bin\Debug folder).  Then it will build the Windows app executable in its project's bin\Debug folder, to which it will also copy the class library DLL so that the executable can access it as a private assembly.
    Saturday, June 16, 2007 7:20 AM