I needed to create a Custom Activity that reads from an XML file and displays the values on the Build log. It’s very easy and I will not re-write how to do the basic Custom Activity, but if you are not familiar with that, you can see the following link: Use and develop custom build process activities
Here, I needed to add OutArgument to return the value that I got from reading the file. I will get the value from the file and assign that value to OutArgument.
After that, I built the project and distributed the library (DLL) under source control where the build controller points for the custom assemblies. See the previous link for the MSDN on how to do that. Open your process template that you want to use the new custom activity and right-click on the Toolbox and browse to the created library as the following image.
Drag and drop your new custom activity, declare a new variable (MyValue) to hold the return value from the reading process as the following image.
The Build summary will be as the following image.
The build log will be as the following image.
Make the activity return a list of strings
We will need to define OutArgument as a <List<string>>
and assign that in the execute method.
Declare a variable (MyValue) but this time the type is a <List<string>>
too. Drag and drop a [For each] Activity of string and print each item in the list as follows:
The Build summary will be as the following image.