views:

44

answers:

2

Is there a way to force the MVC automatically generated code to follow the conventions you have set in your preferences? For example, I keep all curly braces on the same lines as their declaring class, method, etc, but when generating a controller, it completely disregards my settings. Is there a setting someplace to force the same code generation as other parts of project?

A: 

as far as I know MVC is based on T4 templates that you can edit, thereby customizing the way controllers are generated. I'm not familiar with the exact details, I'm sure answers following will elaborate, but that should be the direction.

Ami
+1  A: 

If you have setup your preferences in VS with regards to formatting, then a quick ctrl+k, ctrl+d will reformat it to your settings. Although this does not modify the existing formating of the template, it is a workaround.

Alexander