msbuild/template_feed/content/Microsoft.AnalyzerTemplate
Jenny Bai 2d924ca8c2
pack template for custom analyzer (#10155)
Fixes #9915

Context
#9789 added a template for custom analyzer.
In order for that to be usable by our customers - we need to be publishing this to nuget feed along with our other binaries. So we should have the package produced from our repo - ideally as part of our build script

Changes Made
Create a template package project with property <GeneratePackageOnBuild>true</GeneratePackageOnBuild>that pack the templates into a nuget package when build. Add the package project in the msbuild solution in order to build the project.

Testing
https://dev.azure.com/devdiv/DevDiv/_build/results?buildId=9602998&view=artifacts&pathAsName=false&type=publishedArtifacts in the packageArtifacts folder.

image
2024-05-27 14:24:46 +08:00
..
.template.config pack template for custom analyzer (#10155) 2024-05-27 14:24:46 +08:00
Analyzer1.cs pack template for custom analyzer (#10155) 2024-05-27 14:24:46 +08:00
Company.AnalyzerTemplate.csproj pack template for custom analyzer (#10155) 2024-05-27 14:24:46 +08:00
Company.AnalyzerTemplate.props pack template for custom analyzer (#10155) 2024-05-27 14:24:46 +08:00
README.md pack template for custom analyzer (#10155) 2024-05-27 14:24:46 +08:00

README.md

MSBuild Custom Analyzer Template

Overview

MSBuild Custom Analyzer Template is a .NET template designed to streamline the creation of MSBuild analyzer libraries. This template facilitates the development of custom analyzers targeting .NET Standard, enabling developers to inspect and enforce conventions, standards, or patterns within their MSBuild builds.

Features

  • Simplified template for creating MSBuild analyzer libraries.
  • Targeting .NET Standard for cross-platform compatibility.
  • Provides a starting point for implementing custom analysis rules.

Getting Started

To use the MSBuild Custom Analyzer Template, follow these steps:

  1. Install the template using the following command:
    dotnet new install msbuildanalyzer
    
  2. Instantiate a custom template:
    dotnet new msbuildanalyzer -n <ProjectName>
    
    

Prerequisites

  • .NET SDK installed on your machine.