How to Best Setup a Website Project in VS.NET
I have very little experience with setting up a website from scratch in a .NET environment. As I am doing this now, I am wondering - what's the best way to go? Is it better to create a new Website Project, and include the various backend services and database code as part of that project, or is it better to split out the various aspects of the project? If the second, how would I go about doing that?
I want to ensure that this project is easy to manage in the future (in terms of source control, deployment, etc), so I want to make sure I'm starting off on the right foot. I was unable to find any tutorials online, but if you have any, I would appreciate those as well.
Than开发者_运维技巧ks!
I would strongly recommend having a solution with a website project and then supporting projects for Business Logic and Database Logic.
Not doing that will make your long term options a lot more painful!!.
Also if you are starting out in .NET I would consider going for ASP.NET MVC rather than Web forms but that is of course if your circumstances allow.
You are better off splitting off different aspects of the application into different projects (and therefore assemblies). My standard approach to a new project would be to have a separate DLL for business logic, a separate one for tests, a separate one for the web site itself, and possibly others for data access, utilities, services, etc as needed.
Also, be aware that there are two kinds of web projects in Visual Studio (depending on which version you are using these may be slightly different). There is a "Web Application" project and a "Web Site" project. Avoid Web Site projects like the plague IMO. They break away from the traditional ways that projects work in Visual Studio and are generally harder to work with and never really used in projects you find out in the wild.
I'd suggest you drop the idea of a website project and go for a web application project instead. That gives you a lot more control over your project. Web sites have the great disadvantage of being compiled at execution, which will hide easy-to-spot errors that already occur at compiletime until the code is executed.
精彩评论