您可以使用 EnvDTE 作为预构建事件执行 RunCustomTool 吗?
我正在使用 T4MVC,并且无法使用预构建事件来运行 TextTransform.exe,因为它依赖于 EnvDTE,并且必须使用 Visual Studio 作为主机来运行。
如果我运行过一次自定义工具,它会很好地工作,因为它在执行时将自己标记为脏(AlwaysKeepTemplateDirty = true
),但是当您打开解决方案时,它不会在构建时运行,所以我是想知道是否可以通过 EnvDTE 运行 t4 作为预构建事件?
I am using T4MVC, and I can't use a pre-build event to run TextTransform.exe as it relies on EnvDTE, and must be run with Visual Studio as host.
If I have run custom tool once, it works nicely because it marks itself dirty when its executed (AlwaysKeepTemplateDirty = true
), but when you open the solution, it doesn't run on build, so I was wondering if you could run t4 via EnvDTE as a pre-build event?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我想出了一个方法来做到这一点。它不是最佳的,但它确实有效。如果您连接到 BuildEvents.OnBuildBegin。
按 ALT+F11 进入 Macro IDE,单击 EnvironmenEvents 并在下面的代码片段中添加事件处理程序。确保将其添加到自动生成的代码部分之外。
EnvironmentEvents
现在看起来像这样:I figured out a way to do this. Its not optimal, but it actually works. If you hookup to the BuildEvents.OnBuildBegin.
You push ALT+F11 to get to the
Macro IDE
, clickEnvironmenEvents
and add the eventhandler in the below code snippet . Make sure that its added outside the autogenerated code section.The
EnvironmentEvents
now looks like this:这绝对是我想要解决的 T4MVC 领域之一,但一直未能找到很好的解决方案。我当时确实尝试过使用预构建事件,但没有取得任何有趣的结果。这并不意味着它不能完成。
抱歉,我没有适合您的解决方案,但如果有人想出一些办法,我很乐意将其集成到 T4MVC 中。
大卫
This is definitely one of the areas of T4MVC that I'd like to solve, but haven't been able to find a great solution to. I did make some attempt at the time to use a pre-build event but didn't get anywhere interesting. Which doesn't mean it can't be done.
Sorry, I don't have a solution for you, but if someone comes up with something, I'd be happy to integrate it into T4MVC.
David