You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Source generator DLLs were missing from NuGet packages because PackAsAnalyzer="true" is a custom convention from dotnet/runtime that is not part of the .NET SDK and was silently ignored
Consumers of NuGet packages had no source generation capability because the analyzer DLLs were not included in the analyzers/dotnet/cs/ folder
Need to implement the convention properly in the build system to ensure generators are packaged correctly
Deliverables
Build-time resolution: Create MSBuild target that sets OutputItemType=Analyzer on ProjectReferences marked with PackAsAnalyzer="true" before compilation
Pack-time inclusion: Create MSBuild target that resolves generator DLLs via GetTargetPath and includes them in analyzers/dotnet/cs/ folder in NuGet packages
Global application: Import the new targets in Directory.Build.props so all projects using PackAsAnalyzer automatically benefit from the convention
Description
PackAsAnalyzer="true"is a custom convention fromdotnet/runtimethat is not part of the .NET SDK and was silently ignoredanalyzers/dotnet/cs/folderDeliverables
OutputItemType=Analyzeron ProjectReferences marked withPackAsAnalyzer="true"before compilationGetTargetPathand includes them inanalyzers/dotnet/cs/folder in NuGet packagesDirectory.Build.propsso all projects usingPackAsAnalyzerautomatically benefit from the convention