I needed to create a Custom Activity that read from XML file and display 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 got the value from the file and assign that value to OutArgument.
Image may be NSFW.
Clik here to view.
After that, I built the project and distribute the library (DLL) under source control where the build controller point 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.
Image may be NSFW.
Clik here to view.
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.
Image may be NSFW.
Clik here to view.
The Build summary will be as the following image.
Image may be NSFW.
Clik here to view.
The build log will be as the following image.
Image may be NSFW.
Clik here to view.
Make the activity return list of string
We will need to define OutArgument as List<string> and assign that in the execute method
Image may be NSFW.
Clik here to view.
Declare a variable (MyValue) but this time the type is List<string> too
Drag and drop For each Activity of string and print each item in the list as the followingImage may be NSFW.
Clik here to view.
The Build summary will be as the following image.
Image may be NSFW.
Clik here to view.