Closed Mike-E-angelo closed 7 years ago
It's certainly something I can look at. I'm not sure what you mean by files property list though, are you talking about within the .csproj?
I mean the Properties Window when you select a .tt file in the Solution Explorer: https://www.dropbox.com/s/ljfqgl2grwwj38k/Properties.png?dl=0
It would be awesome to have an additional property there that says "Execute On Build."
:)
Not sure if I'll be able to set custom settings there, but will see what I can do.
Oh, it's definitely possible. 2 of the properties you see there (Custom Tool Parameters and Custom Tool Template) are added when you install T4 Toolbox... although, I'm not sure what they do or how to use them just yet. :P
:thumbsup:
Thanks. I'll suss it out and get a release out in a week or so (time permitting).
Has this been implemented yet? I would like to ONLY turn on this feature with certain .TT files, not just a blanket Auto Transform of all TT files.
I have implemented this but have not pushed it (or merged with master). I will do it on Saturday (or before then if I can).
Coooool. :)
@Michael-DST & @VagyokC4: If you feel like being testers for me, the VSIX is available now from the releases page for v1.1.0.
Let me know if you run into any problems (or if it just doesn't work for some reason).
I've just tested the 1.1.0. VS2013 get restarted most of the time I edit a T4 with Run on build set to False. I've check the activity log and I get this error:
I must mention that I use Tangible T4 editor but Transform on build is set to false. By the way thanks a lot for this new feature! It was just what I was looking for.
Maly
Okay, so clearly still needs work. I will have a look at it later today.
I've experienced no problems with 1.1.0. Its seems to be working as expected for me :+1:
There's definitely some sort of problem with it. In some circumstances it seems to completely crash VS, but I can't reproduce it reliably enough to figure out what's happening. The error above points to a missing null
check somewhere but I can't find anything that I'm not checking.
What do you think about reversing the default logic.. so that Run on build defaults to false, and you selectively turn ON which files should be automatically transformed on build?
I'm not real keen on that. The great thing about it from my point of view is that you install it and in most cases don't have to think about it -- it just works without any configuration.
Make the default setting/behavior read from a setting in app.config?
Or actually... not app.config, but from the .csproj file.
Yes I can see that use case i.e. zero configuration, but I tend to want to 'first do no harm' and since TT files can automatically do a lot of stuff, I can also see the use case of 'Install AutoTT' and tell AutoTT which TT files to 'Run on Build'. Then installing AutoTT without any user interaction will 'first do no harm' and the end-user knows exactly what will happen when he compiles his project.
For example I had my 'EF.Reverse.POCO.Core' TT file hidden down a few folders and at first glance didn't see it... until I compiled my solution and ran into build errors.
If you're the only developer, this is probably less of an issue, but once you start working in teams, and because AutoTT is not a project based nuget, but installs into Visual Studio, and runs regardless of the project you're working on, I can see it having adverse affects if a team member does not realize this.
just my two pennies :)
I've just found the problem. The finalizer in AutoT4Extender was calling dispose on an already finalized object. It's seem that calling dispose in the finalizer was also leading to twice disposal.
To correct the problem simply put this in the finalizer with a proper error message.
~AutoT4Extender() { try { if (_extenderSite != null) _extenderSite.NotifyDelete(_cookie); } catch { } }
You can remove the IDisposable implementation as it will never be called.
PS : I'm also in favor of the default BuildEvent.DoNotRun. I have 45 templates in my solution and it's a pain to set them all to DoNotRun. I also have to remember to set it when adding new templates.
Amazing, thanks. Do you mind submitting a PR for the bug fix?
I'm not keen on changing the default behaviour because it should just work for simple cases, but I can probably help you out. I'll add a 4th option Default
or Inherit
, then give you the option to change the default behaviour from the VS options dialog.
Done with the PR.
Thanks would be great to have this setting.
The latest release should work, and has the additional option to change the default from "Before build" to "After build" or "Disabled".
If nobody reports any problems with that build, I'll push it up to the gallery soon.
Solution folders are not scanned for templates. Added a PR to support this. Added an issue : Templates are not scanned for dependent projects of active project in solution. When you build a project with dependent projects, the dependent projects should be scanned for templates. I'll do a PR when I have time, if you want to support this feature.
Closing since the core work is done and the one remaining issue has been raised independently.
Love this extension... thank you! I was curious if you could possibly add an extension property on the files property list (call it ExecuteOnBuild) that allows you to turn on/off template execution on build on a file-by-file basis.