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.

Home Page:http://bennor.github.io/AutoT4MVC/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Regenerate files on save only, not on build?

kendallb opened this issue · comments

We have a rather large project and I was initially using this tool and it works well, except for the fact that generating the files on every build has two problems for me:

  1. It always opens up the T4MVC.cs file in our Perforce depot, since the file gets saved, even though there are no changes to the file

  2. It adds a reasonable amount of time to the build process with large projects, which is something I would prefer to avoid.

What I really would like is the ability to have AutoT4MVC monitor file saves and if it matches any of the files that should re-generate the template, that it would then go ahead and do it only at that time, not on build. If files somehow get missed, I can always run it manually :)

I looked at AutoTT, but it is not supported in VS2012 yet, and I am not sure how to start porting it.

Hi,

Sorry for taking so long to get back to you. I've been away on holiday.

Can you confirm that you have the latest version? The last version I
switched to running the templates with the "run custom tool" action - -
the same way you would usually do it manually, which should have addressed
problem 1.

As for your second request - it's actually been doing this for a couple of
versions (monitoring files in the Controllers, Views, Scripts and Content
folders). I wouldn't expect it to take very long to build though -- T4MVC
regenerates everything for me in less than a second on a fairly large
project. How many controllers does your project have?

I could take the regenerate on build out of the project, but I worry that
that would cause problems for other people using it. There's no reason why
you couldn't customise it yourself by grabbing the source and building it.
The only dependency is the VS SDK.
On 30/05/2013 6:40 AM, "Kendall Bennett" notifications@github.com wrote:

We have a rather large project and I was initially using this tool and it
works well, except for the fact that generating the files on every build
has two problems for me:

  1. It always opens up the T4MVC.cs file in our Perforce depot, since the
    file gets saved, even though there are no changes to the file

  2. It adds a reasonable amount of time to the build process with large
    projects, which is something I would prefer to avoid.

What I really would like is the ability to have AutoT4MVC monitor file
saves and if it matches any of the files that should re-generate the
template, that it would then go ahead and do it only at that time, not on
build. If files somehow get missed, I can always run it manually :)

I looked at AutoTT, but it is not supported in VS2012 yet, and I am not
sure how to start porting it.


Reply to this email directly or view it on GitHubhttps://github.com//issues/9
.

Hi Bennor,

The first problem is related to how P4VS works in Visual Studio. It always opens the files for write when a template is run even manually. The file is not reverted afterwards if there are no changes. It is easy enough to avoid changes on also the other files, and if does that already in T4MVC, but because VS always writes to the main .cs file that backs the T4 file when a template is run, the file always gets opened. Not a big deal as I always revert unchanged files, and it will be less of a problem is the template is only run on demand.

The problem with build time is our project is large. Not so much at the controller level (but we have a lot there also) but mostly because we use Telerik stuff like Keno, which has a crapload of scripts, CSS and content files that all get monitored. So the T4 templates take a couple of seconds to generate which adds a lot to the normal build process.

So all I really need is a way to turn off the build time support and just have it run it when monitored files and directories change.

Regards,

Sent from my NEW iPad!

Kendall Bennett, CEO
A Main Hobbies
424 Otterson Drive, Suite 160
Chico, CA 95928

On Jun 16, 2013, at 6:32 AM, "Bennor McCarthy" <notifications@github.commailto:notifications@github.com> wrote:

Hi,

Sorry for taking so long to get back to you. I've been away on holiday.

Can you confirm that you have the latest version? The last version I
switched to running the templates with the "run custom tool" action - -
the same way you would usually do it manually, which should have addressed
problem 1.

As for your second request - it's actually been doing this for a couple of
versions (monitoring files in the Controllers, Views, Scripts and Content
folders). I wouldn't expect it to take very long to build though -- T4MVC
regenerates everything for me in less than a second on a fairly large
project. How many controllers does your project have?

I could take the regenerate on build out of the project, but I worry that
that would cause problems for other people using it. There's no reason why
you couldn't customise it yourself by grabbing the source and building it.
The only dependency is the VS SDK.
On 30/05/2013 6:40 AM, "Kendall Bennett" <notifications@github.commailto:notifications@github.com> wrote:

We have a rather large project and I was initially using this tool and it
works well, except for the fact that generating the files on every build
has two problems for me:

  1. It always opens up the T4MVC.cs file in our Perforce depot, since the
    file gets saved, even though there are no changes to the file

  2. It adds a reasonable amount of time to the build process with large
    projects, which is something I would prefer to avoid.

What I really would like is the ability to have AutoT4MVC monitor file
saves and if it matches any of the files that should re-generate the
template, that it would then go ahead and do it only at that time, not on
build. If files somehow get missed, I can always run it manually :)

I looked at AutoTT, but it is not supported in VS2012 yet, and I am not
sure how to start porting it.


Reply to this email directly or view it on GitHubhttps://github.com//issues/9
.


Reply to this email directly or view it on GitHubhttps://github.com//issues/9#issuecomment-19512357.

I'm a little hesitant to take away behaviour that some other people may
have come to expect. I also really don't want to add unnecessary
configuration to the extension, if I can avoid it. Let me have a think
about it and I'll see what I can do to help you.

On Mon, Jun 17, 2013 at 4:42 AM, Kendall Bennett
notifications@github.comwrote:

Hi Bennor,

The first problem is related to how P4VS works in Visual Studio. It always
opens the files for write when a template is run even manually. The file is
not reverted afterwards if there are no changes. It is easy enough to avoid
changes on also the other files, and if does that already in T4MVC, but
because VS always writes to the main .cs file that backs the T4 file when a
template is run, the file always gets opened. Not a big deal as I always
revert unchanged files, and it will be less of a problem is the template is
only run on demand.

The problem with build time is our project is large. Not so much at the
controller level (but we have a lot there also) but mostly because we use
Telerik stuff like Keno, which has a crapload of scripts, CSS and content
files that all get monitored. So the T4 templates take a couple of seconds
to generate which adds a lot to the normal build process.

So all I really need is a way to turn off the build time support and just
have it run it when monitored files and directories change.

Regards,

Sent from my NEW iPad!

Kendall Bennett, CEO
A Main Hobbies
424 Otterson Drive, Suite 160
Chico, CA 95928

On Jun 16, 2013, at 6:32 AM, "Bennor McCarthy" <notifications@github.com
mailto:notifications@github.com> wrote:

Hi,

Sorry for taking so long to get back to you. I've been away on holiday.

Can you confirm that you have the latest version? The last version I
switched to running the templates with the "run custom tool" action - -
the same way you would usually do it manually, which should have addressed
problem 1.

As for your second request - it's actually been doing this for a couple of
versions (monitoring files in the Controllers, Views, Scripts and Content
folders). I wouldn't expect it to take very long to build though -- T4MVC
regenerates everything for me in less than a second on a fairly large
project. How many controllers does your project have?

I could take the regenerate on build out of the project, but I worry that
that would cause problems for other people using it. There's no reason why
you couldn't customise it yourself by grabbing the source and building it.
The only dependency is the VS SDK.
On 30/05/2013 6:40 AM, "Kendall Bennett" <notifications@github.com<mailto:
notifications@github.com>> wrote:

We have a rather large project and I was initially using this tool and
it
works well, except for the fact that generating the files on every build
has two problems for me:

  1. It always opens up the T4MVC.cs file in our Perforce depot, since the
    file gets saved, even though there are no changes to the file

  2. It adds a reasonable amount of time to the build process with large
    projects, which is something I would prefer to avoid.

What I really would like is the ability to have AutoT4MVC monitor file
saves and if it matches any of the files that should re-generate the
template, that it would then go ahead and do it only at that time, not
on
build. If files somehow get missed, I can always run it manually :)

I looked at AutoTT, but it is not supported in VS2012 yet, and I am not
sure how to start porting it.


Reply to this email directly or view it on GitHub<
https://github.com/bennor/AutoT4MVC/issues/9>
.


Reply to this email directly or view it on GitHub<
https://github.com/bennor/AutoT4MVC/issues/9#issuecomment-19512357>.


Reply to this email directly or view it on GitHubhttps://github.com//issues/9#issuecomment-19516772
.

Ok thanks. I timed it yesterday, and on repeated saves it takes about 1-2 seconds for the first web site and 4-5 seconds for the second one. I expect this will get longer and longer as we flesh out the sites more and more.

I will get the same overhead when saving files that affect this as well which is annoying. I really wish there was a way these file save triggers could actually run in the background, but would be required to finish before a build could proceed. Then it would not hang up the foreground process when changes are made to a file and it is saved. A 6-8 second delay on saving files is rather annoying also :(

Regards,

Kendall Bennett, CEO
http://www.AMainHobbies.com
1-800-705-2215 (Toll-Free)
1-530-894-0797 (Local)

Facebookhttp://www.facebook.com/amainhobbies | Twitterhttp://www.twitter.com/AMainHobbies | Youtubehttp://www.youtube.com/AMainHobbiesVideos

On Jun 18, 2013, at 3:14 AM, Bennor McCarthy <notifications@github.commailto:notifications@github.com>
wrote:

I'm a little hesitant to take away behaviour that some other people may
have come to expect. I also really don't want to add unnecessary
configuration to the extension, if I can avoid it. Let me have a think
about it and I'll see what I can do to help you.

On Mon, Jun 17, 2013 at 4:42 AM, Kendall Bennett
<notifications@github.commailto:notifications@github.com>wrote:

Hi Bennor,

The first problem is related to how P4VS works in Visual Studio. It always
opens the files for write when a template is run even manually. The file is
not reverted afterwards if there are no changes. It is easy enough to avoid
changes on also the other files, and if does that already in T4MVC, but
because VS always writes to the main .cs file that backs the T4 file when a
template is run, the file always gets opened. Not a big deal as I always
revert unchanged files, and it will be less of a problem is the template is
only run on demand.

The problem with build time is our project is large. Not so much at the
controller level (but we have a lot there also) but mostly because we use
Telerik stuff like Keno, which has a crapload of scripts, CSS and content
files that all get monitored. So the T4 templates take a couple of seconds
to generate which adds a lot to the normal build process.

So all I really need is a way to turn off the build time support and just
have it run it when monitored files and directories change.

Regards,

Sent from my NEW iPad!

Kendall Bennett, CEO
A Main Hobbies
424 Otterson Drive, Suite 160
Chico, CA 95928

On Jun 16, 2013, at 6:32 AM, "Bennor McCarthy" <notifications@github.commailto:notifications@github.com
mailto:notifications@github.com> wrote:

Hi,

Sorry for taking so long to get back to you. I've been away on holiday.

Can you confirm that you have the latest version? The last version I
switched to running the templates with the "run custom tool" action - -
the same way you would usually do it manually, which should have addressed
problem 1.

As for your second request - it's actually been doing this for a couple of
versions (monitoring files in the Controllers, Views, Scripts and Content
folders). I wouldn't expect it to take very long to build though -- T4MVC
regenerates everything for me in less than a second on a fairly large
project. How many controllers does your project have?

I could take the regenerate on build out of the project, but I worry that
that would cause problems for other people using it. There's no reason why
you couldn't customise it yourself by grabbing the source and building it.
The only dependency is the VS SDK.
On 30/05/2013 6:40 AM, "Kendall Bennett" <notifications@github.commailto:notifications@github.com<mailto:
notifications@github.commailto:notifications@github.com>> wrote:

We have a rather large project and I was initially using this tool and
it
works well, except for the fact that generating the files on every build
has two problems for me:

  1. It always opens up the T4MVC.cs file in our Perforce depot, since the
    file gets saved, even though there are no changes to the file

  2. It adds a reasonable amount of time to the build process with large
    projects, which is something I would prefer to avoid.

What I really would like is the ability to have AutoT4MVC monitor file
saves and if it matches any of the files that should re-generate the
template, that it would then go ahead and do it only at that time, not
on
build. If files somehow get missed, I can always run it manually :)

I looked at AutoTT, but it is not supported in VS2012 yet, and I am not
sure how to start porting it.


Reply to this email directly or view it on GitHub<
https://github.com/bennor/AutoT4MVC/issues/9>
.


Reply to this email directly or view it on GitHub<
https://github.com/bennor/AutoT4MVC/issues/9#issuecomment-19512357>.


Reply to this email directly or view it on GitHubhttps://github.com//issues/9#issuecomment-19516772
.


Reply to this email directly or view it on GitHubhttps://github.com//issues/9#issuecomment-19602249.

I'm here for the same reason. "Zero-configuration" sounds great in concept, but the compile on build is starting to frustrate my team. We try to avoid checking in files that have not been updated, so we're finding ourselves needing to undo-checkout on T4MVC.tt.

It would be great to have a couple config options under Tools > Options | AutoT4MVC (I expect MS will eventually realize the need for a top-level "Extensions" node in their options tree) with the options to enable/disable either "Compile on Save" and/or "Compile on Build".

In the hopes of swaying you further: The purpose of this extension is to save people some time (re: not having to remember to manually compile the tt). So please let us save a bit more time by cutting out unnecessary steps where our internal policies clash with the default behaviour of the extension.

Thanks for your consideration!

Okay. I'll have a look at it this weekend.

I've added an options dialog that lets you disable running on save or at build time to the latest release and I've updated the gallery. You can get to the options quickly via the "AutoT4MVC options..." menu item on right-click of any T4MVC.tt file. 🤘

Awesome! Thank you so much! You rock!

No problem. Glad to help. Hit me up if there are any issues with it, but I've tested it fairly thoroughly myself so it should be okay.

This works much better than always generating on build. However one thing I have noticed is that when the generation that is triggered by a save operation starts, VS is locked up with a spinning cursor until it is done. Is it possible to trigger this to happen in the background, so it won't affect us while it is regenerating? If I have a lot of controllers and views in my project, it can take a decent amount of time to run the script (4-5 seconds for my project). If it was entirely in the background so I would not have to notice it running the re-generation, that would make it much better.

Is it possible to do that?

Regards,

Kendall Bennett, CEO
http://www.AMainHobbies.com
1-800-705-2215 (Toll-Free)
1-530-894-0797 (Local)

Facebookhttp://www.facebook.com/amainhobbies | Twitterhttp://www.twitter.com/AMainHobbies | Youtubehttp://www.youtube.com/AMainHobbiesVideos

On Mar 28, 2014, at 8:42 PM, Bennor McCarthy <notifications@github.commailto:notifications@github.com> wrote:

I've added an options dialog that lets you disable running on save or at build time to the latest release and I've updated the gallery. You can get to the options quickly via the "AutoT4MVC options..." menu item on right-click of any T4MVC.tt file. [:metal:]


Reply to this email directly or view it on GitHubhttps://github.com//issues/9#issuecomment-38985891.

I'm not sure if it's possible, but I will look into it.

On Thu, May 1, 2014 at 5:57 AM, Kendall Bennett notifications@github.comwrote:

This works much better than always generating on build. However one thing
I have noticed is that when the generation that is triggered by a save
operation starts, VS is locked up with a spinning cursor until it is done.
Is it possible to trigger this to happen in the background, so it won't
affect us while it is regenerating? If I have a lot of controllers and
views in my project, it can take a decent amount of time to run the script
(4-5 seconds for my project). If it was entirely in the background so I
would not have to notice it running the re-generation, that would make it
much better.

Is it possible to do that?

Regards,

Kendall Bennett, CEO
http://www.AMainHobbies.com
1-800-705-2215 (Toll-Free)
1-530-894-0797 (Local)

Facebookhttp://www.facebook.com/amainhobbies | Twitter<
http://www.twitter.com/AMainHobbies> | Youtube<
http://www.youtube.com/AMainHobbiesVideos>

On Mar 28, 2014, at 8:42 PM, Bennor McCarthy <notifications@github.com
mailto:notifications@github.com> wrote:

I've added an options dialog that lets you disable running on save or at
build time to the latest release and I've updated the gallery. You can get
to the options quickly via the "AutoT4MVC options..." menu item on
right-click of any T4MVC.tt file. [:metal:]


Reply to this email directly or view it on GitHub<
https://github.com/bennor/AutoT4MVC/issues/9#issuecomment-38985891>.


Reply to this email directly or view it on GitHubhttps://github.com//issues/9#issuecomment-41842647
.