db4ce14dac
* Add Telemetry support. Bump to MSbuild 17+ IBuildEngine5 added support for sending Telemetry data https://learn.microsoft.com/en-us/dotnet/api/microsoft.build.framework.ibuildengine5.logtelemetry?view=msbuild-17-netcore. We need to expose a helper method in the AsyncTask so that tasks using it can log telemetry. We have to use the same pattern as we do for other logging event, the data should be queue'd and then disapatched on the main UI thread so that we can prevent locking. |
||
---|---|---|
Xamarin.Build.AsyncTask | ||
.editorconfig | ||
.gitignore | ||
GitInfo.txt | ||
LICENSE | ||
NuGet.Config | ||
README.md | ||
SignList.xml | ||
Xamarin.Build.AsyncTask.sln | ||
azure-pipelines.yml |
README.md
Xamarin.Build.AsyncTask
Provides the AsyncTask to streamline the creation of long-running tasks that are cancellable and don't block the UI thread in Visual Studio.
Building
msbuild /t:restore && msbuild
That's it.
Installation
install-package Xamarin.Build.AsyncTask
If you're creating a custom task library, just inherit from Xamarin.Build.AsyncTask.
If you're creating an inline task that wants to inherit from AsyncTask, use the following as a template:
<UsingTask TaskName="MyAsyncTask" TaskFactory="RoslynCodeTaskFactory" AssemblyFile="$(MSBuildToolsPath)\Microsoft.Build.Tasks.Core.dll">
<ParameterGroup>
<!-- TODO: your task parameters -->
</ParameterGroup>
<Task>
<Reference Include="$(AsyncTask)" />
<Reference Include="$(MSBuildToolsPath)\Microsoft.Build.Tasks.Core.dll"/>
<Reference Include="$(MSBuildToolsPath)\Microsoft.Build.Utilities.Core.dll"/>
<Code Type="Class" Language="cs">
<![CDATA[
public class MyAsyncTask : Xamarin.Build.AsyncTask
{
public override bool Execute()
{
System.Threading.Tasks.Task.Run(async () =>
{
// TODO: do something long-running
await System.Threading.Tasks.Task.Delay(5000);
// Invoke Complete to signal you're done.
Complete();
});
return base.Execute();
}
}
]]>
</Code>
</Task>
</UsingTask>
CI Builds
Building and pushing from VSTS.