运行T4脚本定制工具RESX文件脚本、文件、工具、RESX

2023-09-06 10:38:31 作者:下個路口說再見

我有一个资源文件 MyResource.resx ,我想怎么改的 MyResource.Designer.cs 文件被生成。

我有一个接受的resx文件作为输入,并给了我所得到的变换,但是,我必须手动才能为它工作运行此T4。

一个T4脚本

我看到自定义工具属性的RESX文件的当前规范是 PublicResXFile codeGenerator ,我把它改为 TextTemplatingFileGenerator ,但只取得了Visual Studio的执行RESX就好像它是一个T4。

如何配置我的T4自动在我的资源运行时的资源被改变了吗?

解决方案

检查了这一点: AutoRunCustomTool 或 下载从Visual Studio库

从自述:

在安装扩展,您应该查看每个项目项物业新的运行自定义工具。只要编辑这个属性添加目标文件(S)的姓名(或名称)。而已!

目标的文件是你.TT文件

I have a resource file MyResource.resx, and I want to change how the MyResource.Designer.cs file gets generated.

I have a t4 script that accepts a resx file as input and gives me the resulting transform, however, I must manually run this t4 in order for it to work.

文件包含漏洞

I see that the "custom tool" property for the resx file is currently specified as PublicResXFileCodeGenerator, I changed it to TextTemplatingFileGenerator, but that only made Visual Studio execute the resx as if it were a t4.

How do I configure my t4 to automatically run on my resource when the resource is changed?

解决方案

Check this out: AutoRunCustomTool or Download from Visual Studio Gallery

From the readme:

After you install the extension, you should see a new Run custom tool on property on each project item. Just edit this property to add the name(s) of the target file(s). That's it!

"target" files are your .tt files