I’ve seen discussed the MVC project structure using a UI Project and a Code Project. e.g.
http://lostechies.com/jimmybogard/2009/12/09/organizing-asp-net-mvc-solutions/
http://stackoverflow.com/questions/4357911/an-ideal-folder-structure-for-net-mvc
I’ve tried to do this in Visual Web Developer 2010 Express but I still end up having the following non-website related files in the UI project: .csproj, .csproj.user, the project dll file and the project pdb file.
This defeats the purpose, as the point of splitting into two projects was to have the UI one clean enough to run directly as the website without having to filter out un-necessary files.
- I copied the original project into a second project contained within the same solution
- I deleted the code files from the first project making it the UI project
- I deletes the UI files from the second project making it the code project
- I added a reference to the code project in the UI project.
Have I done this wrong? Or is this a limitation of this approach?
Any additional detail which might help me get this configuration working would be appreciated.
The reason for separating a project into separate core + UI projects is to cleanly separate the source code concerns.
Two of the files you are mentioning, the CSPROJ and CSPROJ.USER files, are for VWD only. They are not source code, and are not deployed when you publish your project.
The other 2 files, core DLL and core PDB, are runtime assemblies and debug files respectively. Your UI project will need a reference to these in order to be able to run code written and compiled into the core project.
So, having Core.dll and Cord.pdb in the bin folder of your UI project is okay, and doesn’t violate SoC. The csproj files have nothing to do with code, they are only there so that VWD can manage the projects.