How to contribute to T4MVC
Here is a basic guide on what you need to do to contribute changes to T4MVC.
First, read through the general MvcContrib contributor guide
, which explains the full workflow of getting Mercurial, creating a fork, cloning it on your local machine, making changes and pushing them back to CodePlex. Now lets look at some T4MVC specific things.
Locate the T4MVC related files
After doing the previous step, you'll end up with all the MvcContrib files on your machine, not just T4MVC. You’ll find all the T4MVC related files under /src/T4MVC in the repository. Note that most of the files there are really just part of the test app that T4MVC is in for unit testing. When it comes down to it, T4MVC is just two plain text files (T4MVC.tt and T4MVC.settings.t4), and they’re under /src/T4MVC/T4MVCHostMvcApp/T4MVC Files/. There is nothing that really needs to be built per say other than to run the tests.
How to build the T4MVC solution
The correct sequence to build the T4 solution is to first build a test library it depends on (src\T4MVC\SomeClassLibrary\SomeClassLibrary.sln), and then the main T4MVC solution (src\T4MVC\T4MVC.sln).
In case you're curious, the reason this test library is not in the same solution is to force VS to treat it as an external binary rather than a same-solution project. This makes the VS code model (that T4MVC depends on) behave quite differently, making it a good test case that can't be covered with a single solution. Note that you should only have to build this helper library once, as it rarely changes.
Basic description of the T4MVC solution
The T4MVC solution contains two projects: T4MVCHostMvcApp and T4MVCHostMvcApp.Tests.
- T4MVCHostMvcApp is essentially a harness project for T4MVC to execute in. It has the structure of an MVC application, but it is not meant to be run as such. Instead, its purpose is to exercise many of T4MVC's features, so that the T4 template will generate all kind of interesting code.
- T4MVCHostMvcApp.Tests contains unit tests that verify that the right code was generated by the T4MVC template.
To make a change to T4MVC
- Make your change to T4MVC.tt and/or T4MVC.settings.t4
- If necessary, add some files to the T4MVCHostMvcApp project. e.g. you may need a new controller Action or a new static file to make use of the feature
- Write a new unit test that makes sure things work as they should
- Obviously, run all the unit tests and make sure they all pass
- Briefly describe your change in the readme file in the next folder as T4MVC.tt. This will later go in the History page.
Pushing changes back to CodePlex
Now, go back to the main MvcContrib contributor guide
to see how to push your changes.