bennor / AutoT4MVC

A zero-configuration Visual Studio 2012+ extension for automatically running T4MVC templates on build and when files are modified in paths that T4MVC cares about.
http://bennor.github.io/AutoT4MVC/
MIT License
24 stars 9 forks source link

Do not check-out TT file under TFS(Source Safe) source control #8

Closed psulek closed 11 years ago

psulek commented 11 years ago

There can be request (as i have) to not checkout *.tt file which is in my case associated under TFS source control.

To avoid this you must change code in file AutoT4MVCPackage.cs, method RunTemplates , replace current code:

if (!t4MvcTemplate.IsOpen)
   t4MvcTemplate.Open();
t4MvcTemplate.Save();

with this ones:

var projectItem = t4MvcTemplate.Object as VSProjectItem;
if (projectItem != null)
{
    projectItem.RunCustomTool();
}
else
{
    if (!t4MvcTemplate.IsOpen)
        t4MvcTemplate.Open();
    t4MvcTemplate.Save();
}

Here is important change RunCustomTool which execute T4 template without checkout file if file is under TFS.

bennor commented 11 years ago

Thanks for pointing that out. I didn't realise it was possible to get access to the "Run Custom Tool" command. I'm going to push out an update within the next week or so, and I will include this in it.

psulek commented 11 years ago

Good to hear that you include it in official release. Anyway this vs extension is great. We are starting new MVC4 project with this extension.

bennor commented 11 years ago

I've just updated the extension in the gallery, so if you update it should no longer check out the template. Thanks for your comments, but the magic happens in the T4MVC template itself, which I can't take any credit for.