Skip to content

Instantly share code, notes, and snippets.

@benvillalobos
Last active August 10, 2021 22:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save benvillalobos/979addbd7e7418098d7883221c49bdfb to your computer and use it in GitHub Desktop.
Save benvillalobos/979addbd7e7418098d7883221c49bdfb to your computer and use it in GitHub Desktop.
Inline UsingTask Template
<UsingTask TaskName="Foo.Bar" TaskFactory="RoslynCodeTaskFactory" AssemblyFile="$(MSBuildToolsPath)\Microsoft.Build.Tasks.Core.dll">
    <ParameterGroup>
      <AnnotatedProjects ParameterType="Microsoft.Build.Framework.ITaskItem[]" Required="true" />
      <ParentProjectPlatform ParameterType="System.String" Required="true" />
      <PlatformLookupTable ParameterType="System.String" Required="false" />
      <AssignedProjectsWithPlatform ParameterType="Microsoft.Build.Framework.ITaskItem[]" Output="true" />
    </ParameterGroup>
    <Task>
      <Using Namespace="System.Collections.Generic"/>
      <Using Namespace="System.Linq"/>
      <Code Type="Fragment" Language="cs">
      <![CDATA[
          //This is the body of the Execute() method;
      ]]>
      </Code>
    </Task>
  </UsingTask>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment