Repository for the AsyncTask and corresponding nuget package
Перейти к файлу
Dean Ellis db4ce14dac
Add Telemetry support. Bump to MSbuild 17+ (#15)
* 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.
2024-06-04 15:29:40 +01:00
Xamarin.Build.AsyncTask Add Telemetry support. Bump to MSbuild 17+ (#15) 2024-06-04 15:29:40 +01:00
.editorconfig Initial version of the AsyncTask brought from XA 2017-10-03 15:02:02 -03:00
.gitignore Initial version of the AsyncTask brought from XA 2017-10-03 15:02:02 -03:00
GitInfo.txt Bump version to 0.3.0 2019-03-15 14:46:05 -03:00
LICENSE Initial commit 2017-10-03 13:15:31 -03:00
NuGet.Config Pin GitInfo to v2.2.0 (#13) 2023-08-15 14:25:38 +01:00
README.md Add Telemetry support. Bump to MSbuild 17+ (#15) 2024-06-04 15:29:40 +01:00
SignList.xml StrongName Xamarin.Build.AsyncTask Assembly (#7) 2021-07-14 09:02:27 -05:00
Xamarin.Build.AsyncTask.sln Improve package versioning 2019-03-15 13:04:03 -03:00
azure-pipelines.yml Add Telemetry support. Bump to MSbuild 17+ (#15) 2024-06-04 15:29:40 +01:00

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.