How to use a resx resource file in a T4 template
问题 I cant figure out how to include the resource file (.resx) in the (.tt) T4 template. I tried so far... Importing the namespace <#@ import namespace="T4TemplateResources.resx" #> Also including the class 回答1: Nico's solution requires your solution to build. There is another way, without needing to compile your solution by reading the raw resx file. var fileName = "CustomResource.resx"; var filePath = Path.Combine(Path.GetDirectoryName(this.Host.ResolvePath("")), "WindowsFormsApplication1",