120 likes | 237 Vues
This project outlines strategies for improving the setup and management of ASP.NET MVC applications using Visual Studio. By leveraging PowerShell for automation, we aim to simplify package management—streamlining installations, updates, and removals. We will also explore customization techniques through code templates for views and controllers, minimizing messy code while enhancing validation and data representations. Additionally, we'll integrate Less for better CSS management, employing features like mixins and variables to create a more efficient and maintainable project structure.
E N D
File -> New Project E: jonathan@paladincloudware.com G+: +JonathanPeterson42 GitHub & StackOverflow: Eonasdan Jonathan Peterson Paladin Cloudware
Default VS MVC project • Extra Packages like Modernizr • Messy Code • Hour + of preparation to get a project ready
How we’re going to fix it • Using PowerShell to get things going • Less • Web.config • Code templates • Data annotations • EditorFor Templates • Bundles
Using PowerShell to get things setup • PowerShell can be used to automate our first task • Uninstall packages I don’t want • Install packages I always install • Update all the packages that are installed
Using Less • Less gives us Mixins • Parameters and variables • Separate files
Web.Config additions • View/web.config • Web.config and web.release.config
Intermission: papercut http://papercut.codeplex.com
Code Templates • Allows you to customize the OTB Views and Controllers • No more unnecessary comments • No more Resharpersquigglies • C:\Program Files (x86)\Microsoft Visual Studio 12.0\ • Common7\IDE\Extensions\Microsoft\Web\Mvc\Scaffolding\Templates
Data Annotations • Uses for validation (Required, Range, String Length) • Specify field types (Phone, Email) • DisplayFor and ValidationFor text
EditorFor Templates • Must be in Views > Shared > EditorTemplates • Can be customized for each DataType
Strongly Typed bundles • Takes away the guesswork • Easier to make changes to the bundle’s route
Links • Github: http://goo.gl/UhMAFd • Code Templates: • C:\Program Files (x86)\Microsoft Visual Studio 12.0\ Common7\IDE\Extensions\Microsoft\Web\Mvc\Scaffolding\Templates • Less: http://lesscss.org/ • Papercut (SMTP Server): http://papercut.codeplex.com