I tried to use Mono T4 to create some complex templates, but I found a problem.
I created a minimal example that reproduces the problem found, which I present now.
I got the error saying that my property does not exist.
ERROR: Error running transform: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.
---> System.MissingMethodException: Method not found: 'Void Example.Helper.set_FuncProperty(System.Func`2<System.Uri,System.Xml.XmlReader>)'.
at Microsoft.VisualStudio.TextTemplating2534841a.GeneratedTextTransformation.TransformText()
at System.RuntimeMethodHandle.InvokeMethod(Object target, Void** arguments, Signature sig, Boolean isConstructor)
at System.Reflection.MethodBaseInvoker.InvokeWithNoArgs(Object obj, BindingFlags invokeAttr)
--- End of inner exception stack trace ---
at System.Reflection.MethodBaseInvoker.InvokeWithNoArgs(Object obj, BindingFlags invokeAttr)
at System.Reflection.MethodBase.Invoke(Object obj, Object[] parameters)
at Mono.TextTemplating.CompiledTemplate.TemplateProcessor.CreateAndProcess(ITextTemplatingEngineHost host, CompiledAssemblyData templateAssemblyData, String templateAssemblyFile, String fullName, CultureInfo culture, String[] referencedAssemblyFiles)
Can you explain why the T4 tool says the property is not found in the class?
It looks like the generated text transformation code compiles but does not run.
Hello all!
I tried to use Mono T4 to create some complex templates, but I found a problem. I created a minimal example that reproduces the problem found, which I present now.
The .csproj is named Example.csproj:
On my simple class I just created a property to get and set it:
After this, I build the project to get the assembly.
The template file I created uses the class from the referenced assembly:
When I try to run the template with the command:
I got the error saying that my property does not exist.
Can you explain why the T4 tool says the property is not found in the class? It looks like the generated text transformation code compiles but does not run.