How to let the same solution contain multiple different types of items in Visual Studio.net and share the same namespace

zhaozj2021-02-16  124

How to let the same solution in Visual Studio.net contain multiple different types of items

1. Establish a new solution in "Document" -> New "->" Blank Solution ".

2. Add project

In "Solution Explorer", right-click on "Solution MySolution1", add new items, select "ASP.NET Web Application" project as a startup project, named Web. In its Project Attributes General tab, the "program set name" and "default namespace" are changed to "MySolution1.Web" to add a "class library" project (which can be used as a business logic layer, data access layer, etc. ), Named ClassLibrary11. In its Project Properties General tab, the "program set name" and "default namespace" are changed to "MySolution1.classLibrary1", which is to let these items under the same namespace. Change the project output path of the project to the bin directory of the Web project. If there are still multiple items to do it above.

3. Add reference

After generating ClassLibrary1, add the generated .dll file to the reference to the web project, select "Project" when you add a "item" to see the mysolution1.classlibrary1.dll file

4. After using the class to complete the above steps in the Web project, you can use the properties and methods in ClassLibrary1 in the web project, of course, only those common attributes and methods can be used.

转载请注明原文地址:https://www.9cbs.com/read-8630.html

New Post(0)