Skip to content

Convert HotChocolate.Templates to csproj-based template package#9769

Merged
glen-84 merged 2 commits into
mainfrom
gai/templates-package-csproj
May 22, 2026
Merged

Convert HotChocolate.Templates to csproj-based template package#9769
glen-84 merged 2 commits into
mainfrom
gai/templates-package-csproj

Conversation

@glen-84

@glen-84 glen-84 commented May 22, 2026

Copy link
Copy Markdown
Member

Summary

  • Convert HotChocolate.Templates from a legacy .nuspec to an SDK-style .csproj packed by dotnet pack. Drops the NuGet.CommandLine PackageDownload from the Nuke build; PR 3 can stop shipping nuget.exe entirely.
  • Refresh the version placeholder in the three template csprojs from the stale 14.0.0-preview.build.0 to 0.0.0-placeholder — a valid SemVer that reads as an obvious placeholder. Nuke's existing File.Replace substitutes it with the release version at pack time.
  • Bump each template csproj's <TargetFramework> from net8.0 to net10.0, and flip each template.json's "replaces" to match. Default dotnet new graphql instantiation now produces what's in the source, removing the surprising "source != default consumer output" divergence.
  • This is PR 2 of the planned Nuke removal (PR 1 was Remove HotChocolate.Types.Shared and unused build tooling #9764). PR 2 still routes pack/publish through Nuke; PR 3 will switch the workflow to direct dotnet pack / dotnet nuget push plus an inline sed for the placeholder substitution.

Test plan

  • dotnet pack templates/HotChocolate.Templates.csproj -c Release -o /tmp/x /p:Version=16.0.0-test produces a .nupkg with the expected content/azure-function/..., content/gateway/..., content/server/... layout and bundled icon.
  • dotnet new install ./HotChocolate.Templates.16.0.0-test.nupkg registers all three templates.
  • dotnet new graphql -n MyDefaultTargetFramework=net10.0 (default applied via no-op replacement).
  • dotnet new graphql -n MyNet9 --Framework net9.0TargetFramework=net9.0 (replaces working).
  • Next real tag push exercises Nuke's File.Replace of the version placeholder end-to-end. That logic is unchanged from before — only the placeholder string moved.

Copilot AI review requested due to automatic review settings May 22, 2026 08:52

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR migrates the HotChocolate.Templates NuGet template package from a legacy .nuspec-driven pack to an SDK-style .csproj packed via dotnet pack, while also updating the shipped template projects to target .NET 10 and using a clearer version placeholder for internal HotChocolate package references.

Changes:

  • Replace templates/HotChocolate.Templates.nuspec packaging with a new templates/HotChocolate.Templates.csproj that packs the template content and icon via dotnet pack.
  • Update template projects (server/gateway/azure-function) to net10.0 and align template.json framework substitution to replace net10.0.
  • Update build logic to remove NuGet.CommandLine download and switch template packing from NuGetPack to DotNetPack, plus update placeholder replacement text.

Reviewed changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
templates/server/HotChocolate.Template.Server.csproj Bumps template project to net10.0 and switches HotChocolate package versions to 0.0.0-placeholder.
templates/server/.template.config/template.json Updates framework symbol replacement from net8.0 to net10.0.
templates/HotChocolate.Templates.nuspec Removes legacy nuspec-based template packaging definition.
templates/HotChocolate.Templates.csproj Adds SDK-style packing project to produce the template .nupkg via dotnet pack.
templates/gateway/HotChocolate.Template.Gateway.csproj Bumps template project to net10.0 and switches HotChocolate package version placeholder.
templates/gateway/.template.config/template.json Updates framework symbol replacement from net8.0 to net10.0.
templates/azure-function/HotChocolate.Template.AzureFunctions.csproj Bumps template project to net10.0 and switches HotChocolate package version placeholders.
templates/azure-function/.template.config/template.json Updates framework symbol replacement from net8.0 to net10.0.
.build/Build.Publish.cs Switches template packing from NuGetPack to DotNetPack and updates placeholder substitution string.
.build/Build.Environment.cs Updates build path variable from nuspec to the new templates csproj.
.build/Build.csproj Removes NuGet.CommandLine PackageDownload.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread .build/Build.Publish.cs
Comment thread templates/HotChocolate.Templates.csproj
@glen-84 glen-84 merged commit 275bbd7 into main May 22, 2026
274 of 276 checks passed
@glen-84 glen-84 deleted the gai/templates-package-csproj branch May 22, 2026 09:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants