From 6ab02048bf1e5c6449b1ee4917965c79be397763 Mon Sep 17 00:00:00 2001 From: Tig Date: Mon, 25 May 2026 15:16:14 -0600 Subject: [PATCH 1/2] Add optional project reference support for Terminal.Gui source When TerminalGuiRoot is set (e.g. -p:TerminalGuiRoot=../Terminal.Gui), the NuGet PackageReference is replaced with a ProjectReference to the local Terminal.Gui source. This enables immediate detection of breaking changes during Terminal.Gui development. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- Directory.Build.props | 7 +++++++ Directory.Build.targets | 7 +++++++ README.md | 13 ++++++++++++- 3 files changed, 26 insertions(+), 1 deletion(-) create mode 100644 Directory.Build.targets diff --git a/Directory.Build.props b/Directory.Build.props index af65e90..7bb33d5 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -7,4 +7,11 @@ true true + + + + true + diff --git a/Directory.Build.targets b/Directory.Build.targets new file mode 100644 index 0000000..e515bd5 --- /dev/null +++ b/Directory.Build.targets @@ -0,0 +1,7 @@ + + + + + + + diff --git a/README.md b/README.md index 9e01efb..00fda8c 100644 --- a/README.md +++ b/README.md @@ -24,6 +24,17 @@ cd Example dotnet run ``` +### Building Against Local Terminal.Gui Source + +To build the examples against a local clone of Terminal.Gui (instead of the NuGet package), pass the `TerminalGuiRoot` property pointing to your Terminal.Gui repository root: + +```bash +dotnet build -p:TerminalGuiRoot=../Terminal.Gui +dotnet run --project Example -p:TerminalGuiRoot=../Terminal.Gui +``` + +This replaces the NuGet `PackageReference` with a `ProjectReference`, so any breaking changes in Terminal.Gui are caught immediately during development. + ## Examples | Project | Description | @@ -60,7 +71,7 @@ dotnet run ## Contributing 1. Follow Terminal.Gui [coding conventions](https://github.com/gui-cs/Terminal.Gui/blob/develop/CONTRIBUTING.md) -2. Examples should reference Terminal.Gui via NuGet package (not ProjectReference) +2. Examples reference Terminal.Gui via NuGet by default; use `TerminalGuiRoot` for local development 3. Each example should have its own project directory with a descriptive name 4. Include a README.md in each example explaining what it demonstrates From 0a957cc11ad81e0242dd32fd988289c743ae4841 Mon Sep 17 00:00:00 2001 From: Tig Date: Mon, 25 May 2026 15:35:33 -0600 Subject: [PATCH 2/2] Fix: resolve TerminalGuiRoot relative to repo root, not each .csproj ProjectReference paths in Directory.Build.targets are evaluated relative to each importing .csproj. This normalizes TerminalGuiRoot to an absolute path based on the repo root (where Directory.Build.props lives), so relative paths like '../Terminal.Gui' work correctly regardless of which project directory the build is invoked from. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- Directory.Build.props | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Directory.Build.props b/Directory.Build.props index 7bb33d5..336cf50 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -13,5 +13,7 @@ Example: dotnet build -p:TerminalGuiRoot=../Terminal.Gui --> true + + $([MSBuild]::NormalizePath('$(MSBuildThisFileDirectory)', '$(TerminalGuiRoot)'))