You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Would it be possible to get external parameter values using T4ParameterValues items and <#@ parameter #> directives? I'm looking to get a value from a MSBuild property.
Maybe I'm wrong, but as far as I can tell, properties are generated for declared parameters, but they're always null.
If I want to declare a RefAsmPath parameter, the generated Initialize method looks like this (decompiled):
publicvirtualvoidInitialize(){if(((TextTransformation)this).Errors.HasErrors)return;boolRefAsmPathValueAcquired=false;if(((TextTransformation)this).Session.ContainsKey("RefAsmPath")){_RefAsmPathField=(string)((TextTransformation)this).Session["RefAsmPath"];RefAsmPathValueAcquired=true;}if(!RefAsmPathValueAcquired){stringparameterValue= Host.ResolveParameterValue("Property","PropertyDirectiveProcessor","RefAsmPath");if(!string.IsNullOrEmpty(parameterValue)){TypeConvertertc= TypeDescriptor.GetConverter(typeof(string));if(tc!=null&& tc.CanConvertFrom(typeof(string))){_RefAsmPathField=(string)tc.ConvertFrom(parameterValue);RefAsmPathValueAcquired=true;}else((TextTransformation)this).Error("The type 'System.String' of the parameter 'RefAsmPath' did not match the type of the data passed to the template.");}}if(!RefAsmPathValueAcquired){objectdata= CallContext.LogicalGetData("RefAsmPath");if(data!=null)_RefAsmPathField=(string)data;}}
Would it be possible to get external parameter values using
T4ParameterValues
items and<#@ parameter #>
directives? I'm looking to get a value from a MSBuild property.Maybe I'm wrong, but as far as I can tell, properties are generated for declared parameters, but they're always null.
If I want to declare a
RefAsmPath
parameter, the generatedInitialize
method looks like this (decompiled):Except...
Initialize
is never calledSession
is null, soInitialize
would throw anywayHost.ResolveParameterValue
always returnsstring.Empty
CallContext.LogicalGetData("RefAsmPath")
returns null...So I guess there's a lot to do in order to add support 😬
The text was updated successfully, but these errors were encountered: