Nag
Nag

Reputation: 509

Assemblies are removed after building the solution in WinForms

I am developing windows application using 3-tier archtecture. So,i have created two ClassLibraries that contains BAL and DAL

1.DAL -->I Put all the related connection to the database.

2.BAL -->All the business logic

Now the 3rd one is Windows Forms Application template. So my solution contains 3 projects:

Now, when I add the reference dal.dll assembly into my BAL project, then I am using all the related connection object in my BAL Project.

Then, after that I have added BAL asembly means bal.dll into my Windows Forms application.Yes it is added succefully. And i run my project it is working fine.

But the problem comes after building the solution. The output window gives

========== Build: 0 succeeded, 0 failed, 3 up-to-date, 0 skipped ==========

When I rebuild the solution, BAL reference or assembly could not be found.

I didn't understand what is the issue.Because I added those assemblies successfully those are dot net dll's. The targeting framework is .Net FrameWork4.5. I checked that twice.

Note: Those 3 folders under the same solution only. Note: When i build the solution. In my BAL project..bin --->debug-->bal.dll and dal.dll's are removed.This one also embarssing.

Can you help me what's the issue here? Thanks

Upvotes: 0

Views: 155

Answers (2)

StepUp
StepUp

Reputation: 38114

To add a project reference:

  1. In Solution Explorer, select the project.
  2. On the Project menu, click Add Reference. The Add Reference dialog box opens.
  3. Select the tab indicating the type of component you want to reference.
  4. In the top pane, select the component you want to reference, and then click the Select button. Press CTRL while clicking to select multiple components.

Update:

For example: To add DAL library to BAL library:

  • Your BAL project -> Right click on References -> Add reference -> Solution -> select your DAL project

If you are using your BAL assembly at DAL assembly, you should add BAL assembly too like that:

  • Your DAL project -> Right click on References -> Add reference -> Solution -> select your BAL project

Furthermore, you should add your all assemblies to WinForms application:

  • Your WinForms project -> Right click on References -> Add reference -> Solution -> select your BAL and DAL project

Update 2. Difference between your approach and standard approach: When you adding like you have said:

  • BAL project--->Right click on reference -->Add refernce-->Browse-->and select the path add add dal.dll file.Like that bal.dll file also in my window template You just add the .dll to the the folder and your Solution cannot see this assmebly.

However, if you choose the adding by Add Reference, it is right way and all projects can connect with all projects in your solution.

Upvotes: 1

Racil Hilan
Racil Hilan

Reputation: 25351

It's strange, as it should work the way you described it. Perhaps the dlls get deleted after the successful build.

However, the correct way to do it is to add references to the projects, not the assembly dlls. So for example:

BAL project => Right click on reference => Add reference => Solution => and select DAL project

Upvotes: 0

Related Questions