Skip to content

feat(scribe): design for BulletsForHumanity.Scribe.Sdk MSBuild SDK package#6

Merged
crazycrank merged 4 commits into
masterfrom
copilot/create-dotnet-new-project-templates
Apr 6, 2026
Merged

feat(scribe): design for BulletsForHumanity.Scribe.Sdk MSBuild SDK package#6
crazycrank merged 4 commits into
masterfrom
copilot/create-dotnet-new-project-templates

Conversation

Copilot AI commented Apr 6, 2026

Copy link
Copy Markdown
Contributor
  • Analyze all 5 PR review comments — all valid
  • Fix 1: Use proper MSBuild property function for StartsWith in dependency filtering
  • Fix 2: Use $(TargetPath) instead of $(OutputPath)$(AssemblyName).dll for analyzer DLL packaging
  • Fix 3: Move CopyLocalLockFileAssemblies from Sdk.targets to Sdk.props (consumers can override)
  • Fix 4+5: Update README.md and project-setup.md to distinguish overridable defaults from enforced packaging
  • Verify build (0 warnings) + test (88/88) + pack (both packages) still pass

Copilot AI linked an issue Apr 6, 2026 that may be closed by this pull request
11 tasks
Copilot AI changed the title [WIP] Add dotnet new project templates for analyzer and generator feat(scribe): design for BulletsForHumanity.Scribe.Sdk MSBuild SDK package Apr 6, 2026
Copilot AI requested a review from crazycrank April 6, 2026 03:49
@crazycrank crazycrank marked this pull request as ready for review April 6, 2026 04:19
Copilot AI review requested due to automatic review settings April 6, 2026 04:19

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Introduces a new NuGet-delivered MSBuild SDK (BulletsForHumanity.Scribe.Sdk) to standardize and simplify setup/packaging for Scribe-based Roslyn analyzers and source generators, and updates repository/docs to reflect the new recommended workflow.

Changes:

  • Adds Scribe.Sdk/ pack-only project that ships Sdk.props/Sdk.targets, LocalDev infrastructure, and Stubs.cs polyfills.
  • Implements analyzer packaging + dependency bundling behavior via SDK MSBuild targets.
  • Updates solution + documentation (README, project setup, infrastructure architecture) to recommend SDK-based setup.

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
Scribe.slnx Adds the new Scribe.Sdk project to the solution.
Scribe.Sdk/Sdk/Sdk.props Sets early-phase defaults for analyzer/generator projects and imports LocalDev props.
Scribe.Sdk/Sdk/Sdk.targets Adds late-phase packaging targets, dependency bundling, and imports LocalDev targets.
Scribe.Sdk/Scribe.Sdk.csproj Pack-only project that packages SDK assets, stubs, LocalDev files, and metadata.
Scribe.Sdk/README.md Adds SDK-specific usage and behavior documentation.
Scribe.Sdk/content/Stubs.cs Provides netstandard2.0 polyfill stubs injected by the SDK.
README.md Updates “Getting Started” to recommend SDK usage.
docs/project-setup.md Adds an SDK-based setup path and preserves manual setup guidance.
docs/architecture-infrastructure.md Documents SDK package layout, resolution, and phase behavior alongside LocalDev.

Comment thread Scribe.Sdk/Sdk/Sdk.targets Outdated
and '%(ReferenceCopyLocalPaths.NuGetPackageId)' != 'Microsoft.CodeAnalysis.CSharp'
and '%(ReferenceCopyLocalPaths.NuGetPackageId)' != 'Microsoft.CodeAnalysis.Common'
and '%(ReferenceCopyLocalPaths.NuGetPackageId)' != 'Microsoft.CodeAnalysis.Analyzers'
and !%(ReferenceCopyLocalPaths.NuGetPackageId.StartsWith('Microsoft.CodeAnalysis'))

Copilot AI Apr 6, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The exclusion condition !%(ReferenceCopyLocalPaths.NuGetPackageId.StartsWith('Microsoft.CodeAnalysis')) is not valid MSBuild syntax for item metadata and will either fail evaluation or always evaluate truthy/falsey unexpectedly. That risks bundling Microsoft.CodeAnalysis.* assemblies into the analyzer package (causing bloat and potential host version conflicts). Use a proper MSBuild property function (e.g., $([System.String]::Copy('%(ReferenceCopyLocalPaths.NuGetPackageId)').StartsWith('Microsoft.CodeAnalysis'))) or an equivalent explicit check, and ensure the condition reliably filters all Microsoft.CodeAnalysis.* packages.

Suggested change
and !%(ReferenceCopyLocalPaths.NuGetPackageId.StartsWith('Microsoft.CodeAnalysis'))
and '$([System.String]::Copy('%(ReferenceCopyLocalPaths.NuGetPackageId)').StartsWith('Microsoft.CodeAnalysis'))' != 'True'

Copilot uses AI. Check for mistakes.
Comment thread Scribe.Sdk/Sdk/Sdk.targets Outdated
-->
<Target Name="_ScribeSdkAddAnalyzerDlls" BeforeTargets="_GetPackageFiles">
<ItemGroup>
<None Include="$(OutputPath)$(AssemblyName).dll"

Copilot AI Apr 6, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

_ScribeSdkAddAnalyzerDlls packs $(OutputPath)$(AssemblyName).dll, which can point at the wrong location (e.g., multi-targeting adds a TFM subfolder, custom output paths, or when AssemblyName != TargetFileName). This can produce a NuGet package missing the analyzer DLL. Prefer packing $(TargetPath) (or $(TargetDir)$(TargetFileName)) so the correct built output is always included.

Suggested change
<None Include="$(OutputPath)$(AssemblyName).dll"
<None Include="$(TargetPath)"

Copilot uses AI. Check for mistakes.
Comment thread Scribe.Sdk/Sdk/Sdk.targets Outdated
Comment on lines +43 to +45
<PropertyGroup>
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
</PropertyGroup>

Copilot AI Apr 6, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CopyLocalLockFileAssemblies is being set in Sdk.targets, which means consumers cannot override it in their project file (late-phase properties win). However, the docs in this PR state that all properties can be overridden. Either move this default into Sdk.props with a conditional (so consumers can set it), or update the documentation to call out that dependency bundling is enforced by the SDK.

Copilot uses AI. Check for mistakes.
Comment thread Scribe.Sdk/README.md
Comment on lines +51 to +55
| `CopyLocalLockFileAssemblies` | `true` | Enables private dependency bundling |

All properties can be overridden in your `.csproj`.

## Stubs.cs Polyfills

Copilot AI Apr 6, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This README says "All properties can be overridden in your .csproj", but the SDK sets/enforces some behavior in Sdk.targets (late phase) such as dependency bundling (CopyLocalLockFileAssemblies) and packaging targets, which cannot be overridden the same way. Please adjust the wording to distinguish overridable defaults (Sdk.props) from enforced behavior (Sdk.targets), and/or document the specific opt-out switches.

Copilot uses AI. Check for mistakes.
Comment thread docs/project-setup.md Outdated
Comment on lines +48 to +49
All properties can be overridden in your `.csproj`.

Copilot AI Apr 6, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This section says "All properties can be overridden in your .csproj", but the SDK also sets/enforces behavior in Sdk.targets (late phase) which consumers cannot override the same way (e.g., CopyLocalLockFileAssemblies as currently implemented, plus packaging targets). Please update the doc to clarify what is actually overridable vs enforced, and document the supported opt-outs.

Suggested change
All properties can be overridden in your `.csproj`.
Most of these values are SDK defaults and can be overridden in your `.csproj` by setting the property yourself.
However, not every SDK behavior is overridable in the same way. Some behavior is applied or enforced later by the SDK's `.targets` files, so a property set in your project file may not win. In particular, private dependency bundling (`CopyLocalLockFileAssemblies` as configured by the SDK) and analyzer packaging are SDK-managed behaviors and should be treated as enforced unless the SDK documents a specific opt-out.
### Supported opt-outs
The following opt-out is supported in the SDK configuration shown here:

Copilot uses AI. Check for mistakes.
- Use $(TargetPath) instead of $(OutputPath)$(AssemblyName).dll for robustness
- Fix MSBuild StartsWith syntax using proper property function
- Move CopyLocalLockFileAssemblies to Sdk.props (overridable by consumers)
- Clarify overridable defaults vs enforced packaging in docs

Agent-Logs-Url: https://github.com/BulletsForHumanity/Scribe/sessions/ecc9d193-c204-49b1-8184-1d01b404e2b1

Co-authored-by: crazycrank <11194014+crazycrank@users.noreply.github.com>
@crazycrank crazycrank merged commit d6447e9 into master Apr 6, 2026
1 check passed
@crazycrank crazycrank deleted the copilot/create-dotnet-new-project-templates branch April 6, 2026 04:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: create dotnet new project templates for analyzer/generator projects

3 participants