Skip to content

[Feature Request] New MSBuildSdk to simplify creating an MSBuild task package #551

Description

The Problem

The general steps to create a NuGet package that contains MSBuild tasks is outlined here: https://learn.microsoft.com/en-us/visualstudio/msbuild/tutorial-custom-task-code-generation?view=vs-2022#package-the-task-for-distribution

This process requires 8 steps:

  1. Set CopyLocalLockFileAssemblies
  2. Mark all PackageReferences with PrivateAssets="All"
  3. Add the CopyProjectReferencesToPackage target
  4. Set the BuildOutputTargetFolder
  5. Suppress NU5100 and NU5128
  6. Mark Microsoft.Build.* assemblies with ExcludeAssets="runtime"
  7. Set GenerateDependencyFile and add target to copy to output directory
  8. Add the build/, buildTransitive/, buildMultiTargeting/ folders to the package

and I always forget at least one when creating a new project.

The Proposal

Create a new SDK to centralize these steps, and ideally update the docs to point to the SDK instead. In addition to lowering the barrier to authoring MSBuild tasks, centralizing the process for creating an MSBuild task package will make it easier for authors to follow best practices as they evolve (similar to the DotNet.ReproducibleBuilds packages).

I'm happy to do this work myself, but wanted to get approval before starting. Thoughts?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions