The previous article "scaffolding" for the asp.net MVC rc Separation Controllers-views project describes how to separate the controllers and views items and add the "scaffolding" of the MVC RC to the Controllers project. Unfortunately, the "scaffolding" function is too complete, so that the automatic creation and viewing view page will be in the current project, unless you are willing to manually transfer the file to the Views (WEB) project after each creation, the meaning of this "scaffolding" is almost lost. And, in time to transfer a view file such as. aspx, what about viewing it in the current project? This article will create a "stone" approach to address both new and viewed issues in the View page.
View viewing
Because there is no time to study the "scaffolding" of the internal mechanism (if a friend can achieve hack words are not so troublesome, hehe), so thought of a workaround: Can you add some "shortcuts" in the controller, and then look for the source file directly when viewing it? After a few attempts, it is not possible to find a direct creation of a shortcut file (. lnk).
So he made a MyMvc.Controllers.csproj idea. After some test research, we found that. The csproj file supports a <Link> tab and can play a "shortcut" effect in the VS program (details on how to set up the node are visible in the solution program and download code provided later in this article, no longer detailed here).
After a series of tests, these link files will not be compiled into MYMVC.CONTROLLERS.DLL, the ok,view problem is over, the rest of the work is done by a unified solution.
View New
Since the view in the mymvc.controllers is not a practical shortcut, then the new file obviously can not let him stay in the Mymvc.controllers project, so thought of "the great diversion of the universe"-- The new view is automatically moved to the Mymvc.web project, and the corresponding file is programmed with a "shortcut" in MyMvc.Controllers.csproj.
Final Solution--mvcscaffoldtool
Mvcscaffoldtool is the original one I used to solve the previously mentioned scaffolding creation, view file path, the same applies to other types of projects elsewhere.
Since to start from the outside, then the most direct, most automatic method is to write a program to automatically "monitor" the state in the Mymvc.controllers, when it changes automatically transfer files and processing corresponding. csproj files.
Because they rarely do winform, they churn out a: