I'd like to put together some VSTS build / release management extensions in C#, although I can find some generic examples using PowerShell it would be handy to have some examples in C#.
Could anyone point me at a C# VSTS extension example please?
Regarding build task extension, you can specify the C# application, such as console application:
"execution": {
//"PowerShell3": {
// "target": "Hello.ps1",
// "argumentFormat": ""
//}
"Process": {
"target": "..\\ConsoleApplication1.exe",
"argumentFormat": "$(ConnectedServiceName) $(currentDirectory) $(ApiPortalName)"
}
}
However the Task SDK are Typescript and PowerShell, so you can’t use the SDK in your application directly, also the newest schema has removed the extra schema info (check remove extra schema info #308), so NodeJS and PowerShell are the recommended way.
Look at the source of GitVersion. The authors have wrote a TFS/VSTS task associated with it. The core of the tool is pure C#.
Here's the code of their TFS Task https://github.com/GitTools/GitVersion/tree/master/src/GitVersionTfsTask
Here is the task you'd use inside your builds https://marketplace.visualstudio.com/items?itemName=gittools.gitversion#overview