I am making a project file called Business. I have a website project file as well. I want to be able to access the classes in the Business project in the website project. What are the necessary steps in order to make all the right references and includes so that I can successfully use classes from another project. Also, if I want to be able to use the Business project file to access database features do I need a separate web.config file in order to put the connection strings? If so are there necessary steps in order to make a web.config file work with the Business project, such as references etc. Thanks!
I am making a project file called Business . I have a website project
Share
First the Business project to your Website project’s solution.
Then add the Business project as a reference to your website project using the “Add reference” option.
When you see the “Add reference” dialog box, switch to the “Projects” tab and you’ll see the business project listed there.
As regards connection strings in web.config file…
The Website project is the “Application”, the Business project is an assembly. If you have a Data project, then that’s an assembly as well. What you need to know/understand here is that assemblies don’t have app.config/web.config files. They automatically use the “config” file of the “Application” that uses them.
So in other words, your Website project will need to have the connection string in the web.config file. None of the other “library” projects should have or need to have a “config” file of their own.
When the application runs (in this case your Website application) and it uses the services of the Business assembly, the business assembly will automatically “see” the web.config file.