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?
There is no good way to have Visual Studio automatically transform templates whenever a resource changes, but MSDN does call out a setting you can add in your project file to transform on build:
https://msdn.microsoft.com/en-us/library/dd820620.aspx#Regenerating
Check this out: AutoRunCustomTool or Download from Visual Studio Gallery
From the readme:
"target" files are your .tt files