Support loading parameters from properties for Type=Class.#34
Support loading parameters from properties for Type=Class.#34jeffkl merged 1 commit intojeffkl:masterfrom
Conversation
jeffkl
left a comment
There was a problem hiding this comment.
This looks great. I am currently out of town on vacation with very little internet access. I’ll give it a full review when I return on April 25th. Sorry for the delay!
|
@jeffkl Thanks for taking time out of your vacation to respond! |
|
Okay I'm back. I'll preface this with an apology that I just happened to be on vacation when you submitted the issue and this pull request. After thinking about it, I'm of the opinion that when a user specifies What do you think? |
|
I think making it fully automatic should be fine. Warning that they’re ignored if specified would be the best behavior because users will wonder why removing a parameter from that list fails to remove the parameter from the created task (using the This would need to be documented in a list of behavioral differences between RoslynCodeTaskFactory and .netfx CodeTaskFactory. I can update my PR but it might take me a day to find the time to do so. |
|
Okay no hurry. I'm in the process of porting my code task factory directly into MSBuild: dotnet/msbuild#3175 I'll port your change into that submissions as well after we've merged this. Thanks for the contribution! |
When authoring a Task in an assembly, task parameters are declared simply by creating public properties. CodeTaskFactory instead requires the user to manually declare all properties in a <ParameterGroup/> element. This is tedious when using Type="Class" because the parameters must be listed both as property declarations and in <ParametersGroup/>. Also, this requirement increases maintenance when using inheritence to extend or intercept an existing Task from another assembly. This change causes simple reflection to be used to calculate the parameters for all Type="Class" tasks. A warning is emitted if <ParameterGroup/> is specified and it is ignored. Fixes jeffkl#33.
|
I’ve updated to have a warning an ignore any supplied |
When authoring a Task in an assembly, task parameters are declared
simply by creating public properties. CodeTaskFactory instead requires
the user to manually declare all properties in a
element. This is tedious when using Type="Class" because the
parameters must be listed both as property declarations and in
. Also, this requirement increases maintenance when
using inheritence to extend or intercept an existing Task from another
assembly.
This change adds an AutoDetectParameters="True" option to the
element for Type="Class". When enabled, simple reflection is used to
calculate the parameters and any parameters provided via
are ignored.
Fixes #33.