Click here to Skip to main content
15,892,927 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

I have a windows application with 6 forms in it.

I want to convert the project such that it should have only one exe file and the remaining are dll files so that if at all I have any further changes in future I will only change the dll file.

I tried changing the application type to class library but it is not working, it is showing error

"In order to debug this project add an executable project to the solution which references to the library project"

Detail step by step explanation is appreciated I am new to .net
Posted
Updated 6-Sep-10 8:02am
v2
Comments
Dalek Dave 6-Sep-10 14:03pm    
Edited for Grammar.

Hi,

Your solution would not be able to run the library project, it can compile and generate linked library (dll) for it. You can segregate your win forms from business logic and put the business logic in the class library and refer the respected functions in Windows Application. I believe that you solve your purpose.

Regards,
Sushant.
 
Share this answer
 
Comments
anupama962010 6-Sep-10 7:25am    
can u tell me in detail like step by step i am beginer
First, identify the Business Logic, Data Layer & Presentation/Application Layer logic in your application. Later, keep only the Presentation layer logic in your Windows Forms. In the next step, add a Class Library type of Project to your Solution. Move all the Business Layer logic to the Business Layer project. I would suggest if you could segregate the Data Layer as well, it would be good and code would be more maintainable. Later on, you would have to set the Application Layer Project i.e. Windows Form Project as start-up Project, unless your application has multiple start-up projects. Then, build the Class Library and add the refrence to Windows Form Project. Now, in the place where you had written your business level logic, you would have to replace it with the function calls to the Business Layer i.e. the Class Library functions. This would reduce the code redundancy and the same peice can be easily reused by sharing the DLL.

I hope this explanation is of some use to you.
 
Share this answer
 
To execute your Class Library Logic in Visual Studio, you need to:

1. Add a Windows Application project to the solution.
2. Create a Reference from the new project to the existing Class Library Project.
3. Add Code to the new Windows Application Project that invokes the existing class library project. E.g. Stick a button on a form and put the code you need behind that.

If any of these steps need more explaination then I can go into more detail.

-Rd
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900