Closed binki closed 6 years ago
So far, it looks like RoslynCodeTaskFactory
isn’t passed enough information by MSBuild to detect whether or not <ParameterGroup/>
is present. Thus, it is impossible to implement the implicit option. For now, I’ll go with AutoDetectParameters="true"
as the explicit opt-in.
Package will be available shortly
It would be very useful for me if I could declare a
Task
using theClass
syntax and let the parameters be automatically discovered just as if myTask
was declared in an assembly. I think that if I wrote myTask
as an assembly, MSBuild would use reflection over the properties of my class to discover which properties are supported. This means that if I am overriding an existingTask
to intercept/extend it, I would automatically inherit the properties it uses and can augment them with additional properties.However, for
CodeTaskFactory
andRoslynCodeTaskFactory
, currently the parameters must be explicitly provided via<ParameterGroup/>
. This makes sense and is even required forType="Fragment"
andType="Method"
. However, this is quite limiting for my use case ofType="Class"
.My idea for the design of this would be to add a new parameter to the
<Code/>
element to enable this capability. Another option is to simply automatically do parameter discovery when<ParameterGroup/>
is absent andType="Class"
. Two hypothetical examples of these options:Explicit
AutomaticParameters="True"
:Implicit omission of
<ParameterGroup/>
:I’m planning to try to implement this. Please let me know if you have any suggestions and if this functionality would be accepted into RoslynCodeTaskFactory.