Skip to content

Clean up legacy cswinrt native project and refresh docs#2428

Draft
Sergio0694 wants to merge 17 commits into
staging/CodeWritersfrom
user/sergiopedri/cleanup-code-writers
Draft

Clean up legacy cswinrt native project and refresh docs#2428
Sergio0694 wants to merge 17 commits into
staging/CodeWritersfrom
user/sergiopedri/cleanup-code-writers

Conversation

@Sergio0694

Copy link
Copy Markdown
Member

Summary

Clean up the legacy native cswinrt C++ project, its test/validation
scaffolding for WinRT.Projection.Writer, and refresh the repository
documentation to reflect the completed C++ to C# code writers port.

Motivation

The C++ to C# port of the projection compiler is complete: the new
WinRT.Projection.Writer library (consumed in-process by
cswinrtprojectionrefgen.exe and cswinrtprojectiongen.exe) has fully
replaced the legacy cswinrt.exe native build tool. With the port done
and validated, the old native project, the temporary test runner, and
the golden-output validation harness are no longer needed and should be
removed from the tree. The Copilot instructions and docs/ content
also still referred to the old layout and need to be brought in line
with the current 3.0 architecture.

Changes

Removed legacy native project (fb3a809a)

  • src/cswinrt/: deleted the entire native C++ project, including
    cswinrt.vcxproj, main.cpp, code_writers.h, helpers.h,
    cmd_reader.h, settings.h, text_writer.h, type_writers.h,
    task_group.h, guid_generator.h, WindowsRuntime.Internal.idl,
    Directory.Build.props/targets, packages.config, pch.*,
    cswinrt.natvis, PreviousPlatforms.linq, and version.rc.
  • src/cswinrt.slnx: dropped the cswinrt.vcxproj solution entry
    and removed BuildDependency references from BenchmarkComponent,
    TestComponentCSharp, and TestComponent.
  • Project files under src/Projections/ and src/Tests/: removed
    ProjectReference entries to cswinrt.vcxproj from Benchmark,
    Test, TestHost.ProbeByClass, TestPublicExclusiveTo,
    TestSubset, WinAppSDK, Windows.UI.Xaml, Windows,
    AuthoringTest, and AuthoringWuxTest.

Removed writer validation harness (3301f001)

  • src/WinRT.Projection.Writer/eng/validate-writer-output.ps1:
    deleted the SHA256 golden-manifest capture/validate script
    (capture / validate / capture-and-validate modes).
  • src/WinRT.Projection.Writer/eng/README.md: deleted the
    accompanying documentation for the harness.

Removed test runner project (9d8524d3)

  • src/WinRT.Projection.Writer.TestRunner/: deleted the CLI test
    runner (Program.cs with compare/rsp/smoke modes and several smoke
    tests) and its .csproj.

Refreshed documentation (0ac5ce17)

  • .github/copilot-instructions.md: replaced the cswinrt/ entry
    with two new sections (WinRT.Projection.Writer library and
    WinRT.Projection.Ref.Generator CLI tool), updated the architecture
    Mermaid diagram, refreshed the WinRT.Runtime2 directory tree,
    bumped the source generator counts (5 analyzers / 10 diagnostics,
    adding CSWINRT2009), added RunCsWinRTProjectionRefGenerator to
    the generator tasks list, added Reference Projection Generator and
    Projection Writer rows to the error ID ranges, and updated the NuGet
    pipeline table.
  • docs/structure.md: dropped the src/cswinrt section, added
    sections for src/WinRT.Projection.Writer and
    src/WinRT.Projection.Ref.Generator, and updated the
    WinRT.Projection.Generator and WinRT.Generator.Tasks
    descriptions.
  • docs/usage.md: replaced cswinrt -? with
    cswinrtprojectionrefgen -h and updated the Mermaid edge label in
    the Generate reference projection diagram.
  • docs/interop.md, docs/diagnostics/cswinrt30001.md,
    nuget/readme.md: replaced cswinrt.exe mentions with
    references to the CsWinRT projection writer.
  • .github/skills/update-copilot-instructions/SKILL.md: updated
    the project count to 10, replaced the cswinrt.exe validation entry
    with Projection writer + Reference projection generator, and
    expanded the generator tasks validation checklist.

@Sergio0694 Sergio0694 added documentation Improvements or additions to documentation code cleanup Code cleanup and refactoring CsWinRT 3.0 labels Jun 7, 2026
@Sergio0694 Sergio0694 requested a review from manodasanW June 7, 2026 23:55
@Sergio0694 Sergio0694 marked this pull request as draft June 8, 2026 00:18
Sergio0694 and others added 15 commits June 7, 2026 17:23
Add a new SDK project src/WinRT.Internal/WinRT.Internal.csproj targeting net10.0 with implicit usings and nullable enabled. Also update cswinrt.slnx to include the new project (solution entry: WinRT.Internal/Windows.Internal.csproj).
Port the contents of src/cswinrt/WindowsRuntime.Internal.idl to C#
source files in the new src/WinRT.Internal project, in preparation for
removing the legacy C++ cswinrt project. The C# definitions cover:

- HWND struct (custom-mapped to System.IntPtr by the projection writer).
- [ProjectionInternal] custom attribute (consumed by CsWinRT to emit
  internal projections for the marked interfaces).
- All 14 interop interfaces (IAccountsSettingsPaneInterop,
  IDisplayInformationStaticsInterop, IDragDropManagerInterop,
  IInputPaneInterop, IPlayToManagerInterop, IPrintManagerInterop,
  IRadialControllerConfigurationInterop,
  IRadialControllerIndependentInputSourceInterop,
  IRadialControllerInterop, ISpatialInteractionManagerInterop,
  ISystemMediaTransportControlsInterop, IUIViewSettingsInterop,
  IUserConsentVerifierInterop, IWebAuthenticationCoreManagerInterop)
  with their original IIDs, parameter lists, and reference links
  to the corresponding Win32 *interop.idl documentation pages.

Each interface carries [Guid(...)] (from System.Runtime.InteropServices)
and [ProjectionInternal], and exposes the same methods as the IDL with
the same parameter order. The "riid" out-parameter selector uses
"ref Guid riid" rather than "in" / "[In] ref" so that the C# compiler
emits a plain "Guid&" byref without "modreq(InAttribute)" /
"modopt(IsReadOnlyAttribute)" decorations.

The csproj targets "net10.0-windows10.0.26100.1" (revision .1 selects
the cswinrt3 Windows SDK projection reference assemblies, which carry
[WindowsRuntimeMetadata] attributes the WinMD generator reads) and
pins WindowsSdkPackageVersion to the matching SDK NET Ref package so
the implicit FrameworkReference resolves. All CsWinRT MSBuild
processing (CsWinRTEnabled / CsWinRTGenerateProjection /
CsWinRTGenerateInteropAssembly[2]) is disabled because this project
itself feeds back into the CsWinRT build pipeline. It references the
locally built WinRT.Runtime.dll directly via a HintPath so it does
not require the Microsoft.Windows.CsWinRT NuGet package.

The output .dll is only an intermediate artifact; the .winmd that the
CsWinRT toolchain consumes will be wired up in a follow-up commit.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…sion

Two small fixes to the WinMD generator needed for the C# port of
WindowsRuntime.Internal.idl to produce metadata compatible with both
the existing toolchain and the original C++-generated .winmd:

1. Preserve [In] / [Out] parameter direction flags from input
   parameters. Previously, GetWinRTParameterAttributes unconditionally
   returned ParameterAttributes.Out for any by-reference parameter,
   which is wrong for "ref Guid riid"-style COM interop signatures
   that MIDL emits as [in] ref. The new logic honors any explicit
   In/Out flag already set by the C# compiler on the input parameter,
   and only falls back to a type-based heuristic when no flag is set
   (Span<T> -> [out], everything else including byref -> [in]).
   This matches MIDL's convention for "ref const T" parameters and
   keeps the projection writer's ParameterCategoryResolver classifying
   them as Ref rather than Out.

2. Always stamp the .winmd assembly identity with version
   255.255.255.255 (the WinRT "unbound" convention used by every
   Windows Runtime metadata assembly). The "--assembly-version"
   argument is still used as-is for the type-level
   "[Windows.Foundation.Metadata.Version]" attribute applied to each
   authored type. Verified against the existing TestComponent and
   TestComponentCSharp .winmd outputs, both of which carry
   v255.255.255.255 as their assembly identity regardless of the
   project's <AssemblyVersion>.

Also bumps the WinRT.Internal csproj to use AssemblyName
"WindowsRuntime.Internal" so the produced .dll (and its .winmd) match
the identity that the rest of the CsWinRT toolchain expects.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Adds an MSBuild target to WinRT.Internal.csproj that invokes
'cswinrtwinmdgen.exe' (built from this solution) after CoreCompile and
emits 'WindowsRuntime.Internal.winmd' next to the compiled
'WindowsRuntime.Internal.dll' in '$(TargetDir)'.

Adds ProjectReference items to WinRT.WinMD.Generator (the tool
'cswinrtwinmdgen.exe') and WinRT.Generator.Tasks (the
RunCsWinRTWinMDGenerator MSBuild task) with
ReferenceOutputAssembly=false so they participate in the build graph
without becoming runtime references. The 'UsingTask' resolves the task
assembly out of the locally built WinRT.Generator.Tasks output, and
the tool path is computed from the locally built WinRT.WinMD.Generator
output. 'CsWinRTToolsArchitecture=AnyCPU' is passed so the tool task
uses the top-level 'cswinrtwinmdgen.exe' apphost wrapper (no per-arch
publish folder).

Verified: the produced 'WindowsRuntime.Internal.winmd' contains
exactly the same set of public types as the legacy C++-generated
'WindowsRuntime.Internal.winmd' (HWND struct, all 14 interop
interfaces with their original IIDs and method counts, and the
ProjectionInternalAttribute class). The only extra entry is a
synthesized 'IProjectionInternalAttributeClass' interface that the
C# WinMD generator emits for attribute classes; it is non-public and
is filtered out by the projection writer's
'AssemblyAnalyzer.DiscoverPublicTypes' step.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Now that WinRT.Internal produces WindowsRuntime.Internal.winmd via the
C# WinMD generator, point all build infrastructure at the new file
instead of the legacy cswinrt (C++) bin directory. The output cswinrt
project still exists on disk for now but no longer needs to be built
for any consumer of WindowsRuntime.Internal.winmd to function; that
project will be deleted in a follow-up commit.

Specifically:

- src/Directory.Build.props:
  - 'CsWinRTInteropMetadata' now resolves to
    'src/WinRT.Internal/bin/$(Configuration)/$(CsWinRTInternalTargetFramework)/WindowsRuntime.Internal.winmd'
    (with 'CsWinRTInternalTargetFramework' defaulting to
    'net10.0-windows10.0.26100.1', matching the WinRT.Internal csproj
    TFM that selects the cswinrt3 SDK projection reference assemblies).
  - 'AssemblyVersionNumber' now defaults to '3.0.0.0' (the WinRT
    runtime baseline for CsWinRT 3.0). Without this, dev builds of
    WinRT.Runtime would stamp v1.0.0.0 by default, and the cswinrt3
    SDK projection would fail to resolve against the local runtime.
  - 'CsWinRTPath' / 'CsWinRTExe' are kept defined (still pointing at
    the legacy cswinrt bin folder), but only as path strings: the C#
    'cswinrtprojectiongen.exe' tool no longer reads or executes the
    .exe path, so the file no longer needs to exist. They will be
    removed entirely once 'src/cswinrt' itself is dropped.

- src/build.cmd: 'interop_winmd' now points at the WinRT.Internal
  output instead of '_build/{platform}/{config}/cswinrt/bin/'.

- build/AzurePipelineTemplates/CsWinRT-Build-Steps.yml: the "Stage
  WindowsRuntime.Internal.winmd" task copies from
  'src/WinRT.Internal/bin/$(BuildConfiguration)/net10.0-windows10.0.26100.1/'
  rather than the cswinrt bin folder; staging into
  '$(StagingFolder)/native' is preserved so the downstream nuget pack
  step (CsWinRT-PublishToNuGet-Steps.yml) still finds the file at the
  same place.

- src/cswinrt.slnx: WinRT.Internal no longer carries '<Build
  Project="false" />' so it participates in default solution-level
  builds.

- src/WinRT.Internal/WinRT.Internal.csproj: switches from
  '<Reference HintPath="..." />' to '<ProjectReference Private="false"
  />' for WinRT.Runtime so that 'dotnet build' on this project alone
  implicitly builds WinRT.Runtime2 first (no copy of WinRT.Runtime.dll
  into bin).

Verified end-to-end: 'dotnet build src/WinRT.Sdk.Projection/...' now
consumes the new WindowsRuntime.Internal.winmd and produces
WinRT.Sdk.Projection.dll containing the expected
'ABI.WindowsRuntime.Internal.IAccountsSettingsPaneInteropMethods'
internal projection (alongside the regular projected
'Windows.UI.ApplicationSettings.AccountsSettingsPane' runtime class),
confirming the full interop pipeline still works.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Refactor several WinRT.Internal sources and adjust project settings:

- HWND.cs: add pragma to suppress naming warning, rename reserved field to __Reserved, document projection to nint and add reference link.
- Interop interfaces: normalize GUID literals to uppercase for IPrintManagerInterop, IRadialControllerConfigurationInterop, ISystemMediaTransportControlsInterop, and IUIViewSettingsInterop.
- ProjectionInternalAttribute.cs: add C# language tag to the code sample and convert the attribute type to a forward declaration (public sealed class ProjectionInternalAttribute : Attribute;).
- WinRT.Internal.csproj: clean up XML/comments, include BOM, disable nullable (Windows Runtime types don't support nullability annotations), adjust NoWarn entries, inline ProjectReference entries, and reformat UsingTask/Target elements.

These changes improve consistency, clarify projection mappings, and update build settings to match the Windows Runtime metadata requirements.
When Visual Studio (or the persistent 'dotnet build-server') loads
'WinRT.Generator.Tasks.dll' to run the 'RunCsWinRTWinMDGenerator'
custom MSBuild task, the main MSBuild process keeps the assembly
loaded for the lifetime of the build session. The 'ProjectReference'
from WinRT.Internal to WinRT.Generator.Tasks then triggers
WinRT.Generator.Tasks to rebuild on the next incremental build (or
the next 'right-click -> Build' in VS), which fails with:

  warning MSB3026: Could not copy ... WinRT.Generator.Tasks.dll ...
  The file is locked by: "MSBuild.exe (...) , MSBuild.exe (...), ..."
  error MSB3027: ... Exceeded retry count of 10.

Adding 'TaskFactory="TaskHostFactory"' to the 'UsingTask' loads the
task in a separate 'MSBuild.TaskHost' child process, which exits
after the build, so the main MSBuild process never keeps a handle
to 'WinRT.Generator.Tasks.dll'. Subsequent rebuilds can then
overwrite it without contention.

Verified with three back-to-back 'dotnet build' invocations that
each trigger 'CoreCompile' on WinRT.Internal (and, in the third
case, a rebuild of WinRT.Generator.Tasks itself): all complete
cleanly with 0 warnings / 0 errors and 'WindowsRuntime.Internal.winmd'
gets regenerated.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Add explicit properties and invoke the WinMD generator task to produce this project's .winmd and ensure incremental builds recognize the generated file. Introduces _CsWinRTWinMDGenToolsDirectory and _CsWinRTInternalWinMDOutputPath, calls RunCsWinRTWinMDGenerator with those paths, and adds a FileWrites entry for the generated .winmd. Also reformats the UsingTask tag and adds inline comments for clarity.
The previous 'TaskFactory="TaskHostFactory"' attempt did not fully
resolve the file-lock issue in Visual Studio: VS keeps multiple
'MSBuild.exe' build-server processes alive across IntelliSense and
build sessions, and at least one of them ends up holding a handle to
'WinRT.Generator.Tasks.dll' even with the task host opt-in. The result
in VS is the same 'MSB3027' (file locked by multiple 'MSBuild.exe'
processes) error on every other build of WinRT.Internal.

The root issue is that this project depends on its own custom MSBuild
task ('RunCsWinRTWinMDGenerator' from WinRT.Generator.Tasks) and is
also part of the build graph that produces that task assembly via a
'ProjectReference'. Any time MSBuild loads the task DLL during a build
session and VS later tries to rebuild it, the copy fails.

Rather than chase that contention, this commit removes the custom-task
dependency for this project entirely:

- Drops the 'ProjectReference' to WinRT.Generator.Tasks (no longer
  needed).
- Drops the 'UsingTask' / 'RunCsWinRTWinMDGenerator' call.
- Invokes 'cswinrtwinmdgen.exe' directly via a stock '<Exec>' task
  with a generated '.rsp' response file passed as '@<file>' (the same
  format 'ConsoleAppFramework' / 'WinMDGeneratorArgs.ParseFromResponseFile'
  already understands).

The response file is written under '$(IntermediateOutputPath)' via
'<WriteLinesToFile WriteOnlyWhenDifferent="true">' and registered as
a 'FileWrites' item so it's tracked by the incremental-build cache.
The end-to-end behavior is identical to before — same arguments,
same generator, same '.winmd' output — but the build never loads
'WinRT.Generator.Tasks.dll' into MSBuild's process space, so it can
freely be rebuilt at any time.

Verified with four back-to-back 'dotnet build' invocations on the
same build server, each triggering a different point in the
dependency chain (HWND.cs source change -> rebuild of
'WinRT.Generator.Tasks.dll' itself -> rebuild of
'cswinrtwinmdgen.exe' itself), all completing with 0 errors and the
'.winmd' regenerated correctly each time.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Reformat and clarify WinRT.Internal.csproj: normalize header, collapse XML comment into a block, wrap ProjectReference attributes across lines for readability, tweak comment wording, add comments around preparing/writing the generator '.rsp' file, and mark the response and output files in FileWrites to help incremental builds. Also small doc fix in WinMDWriter: fully qualify ReadOnlySpan/Span as System.ReadOnlySpan/System.Span in XML docs to avoid ambiguity.
Clarify and normalize in-code comments and formatting across the repo and remove a stale comment in the build script. Changes touch Directory.Build.props, WinMD.WinMD.Generator (WinMDValues.cs, WinMDWriter.Members.cs, WinMDWriter.cs) and build.cmd. All edits are comment/whitespace-level (consistent quoting, naming like 'Windows Runtime'/'WinRT.Runtime', and punctuation) and do not change runtime behavior.
Remove the cswinrt native project and its references across the repo. Deleted the src/cswinrt project files and sources (Directory.Build.props/targets, headers, sources, IDL, generators, etc.), removed ProjectReference entries to cswinrt.vcxproj from multiple Projections and Test csproj files, and updated src/cswinrt.slnx to drop the cswinrt project and related build dependencies. This cleans up the solution by removing the legacy/native cswinrt component and its build hooks.
Delete the golden-output validation harness and its documentation for WinRT.Projection.Writer. Removes src/WinRT.Projection.Writer/eng/validate-writer-output.ps1 and the accompanying README.md which captured/validated per-scenario SHA256 manifests for emitted .cs files (capture/validate/capture-and-validate modes and baseline files).
Delete the WinRT.Projection.Writer.TestRunner application and its project file. Removes src/WinRT.Projection.Writer.TestRunner/Program.cs (the CLI test runner implementing compare/rsp/smoke modes and various smoke tests) and src/WinRT.Projection.Writer.TestRunner/WinRT.Projection.Writer.TestRunner.csproj to clean up the repository.
Update the Copilot instructions and supporting .md docs to reflect the deletion of the legacy C++ 'cswinrt.exe' code writers and its replacement by the C# WinRT.Projection.Writer library (consumed in-process by the new cswinrtprojectionrefgen.exe and the existing cswinrtprojectiongen.exe).

.github/copilot-instructions.md:
- Repository structure: removed 'cswinrt/' entry, added WinRT.Projection.Writer/ (library) and WinRT.Projection.Ref.Generator/ (CLI tool); renumbered the 9 projects to 10.
- Architecture Mermaid diagram: replaced 'cswinrt.exe' with 'cswinrtprojectionrefgen.exe' as the CsWinRTGenerateProjection front-end; added a 'Shared projection writer' callout explaining the in-process library model.
- Project details: replaced the entire 'cswinrt.exe' section with two new sections - 'Projection writer' (public ProjectionWriter.Run API, options, resources/additions/base layout, internal-interop-interfaces description relocated here) and 'Reference projection generator' (Native AOT CLI tool replacing the legacy invocation in CsWinRTGenerateProjection). Renumbered the remaining sections (Impl/Projection/Interop/WinMD/Generator-tasks/SDK-projection-builds) to 5-10. Rewrote the Projection generator section to drive the writer in-process (no more 'invoke cswinrt.exe @response.rsp').
- WinRT.Runtime2 directory tree: refreshed to current layout - added Bindables, Buffers, Dispatching, Extensions, Placeholders, ProjectionDllExports, Streams, System.Runtime.InteropServices and InteropServices/Attributes; removed Windows.Foundation.Collections.
- Source generator section: 4 analyzers / 9 diagnostics -> 5 analyzers / 10 diagnostics; added CSWINRT2009 (ComImportInterfaceAnalyzer warning).
- Generator tasks: 4 tasks -> 5 tasks (added RunCsWinRTProjectionRefGenerator).
- Code style: dropped the 'C++ project (cswinrt)' subsection (project deleted).
- Naming / build-tool conventions: 4 .NET build tools -> 5; new WindowsRuntime.ProjectionWriter / WindowsRuntime.ReferenceProjectionGenerator namespaces; updated assembly-name list.
- Error ID ranges: added Reference Projection Generator + Projection Writer rows; corrected ranges for Impl (0001-0014), Interop (0001-0097), WinMD (added 9999); documented the writer's 5xxx reservation within the shared CSWINRTPROJECTIONGEN prefix.
- NuGet pipeline table: dropped 'CsWinRTExe' from the props row, updated CsWinRT.targets description, added Microsoft.Windows.CsWinRT.Native.targets row.
- 'by cswinrt.exe' prose mentions in the custom-mapped / manually-projected sections replaced with 'by the projection writer'.

docs/structure.md:
- Removed the 'src/cswinrt' section.
- Added 'src/WinRT.Projection.Writer' and 'src/WinRT.Projection.Ref.Generator' sections in alphabetical position.
- Dropped 'cswinrt.exe' from the NuGet contents sentence.
- Updated WinRT.Projection.Generator to reference the writer library.
- Updated WinRT.Generator.Tasks description to include the new ref-generator task.

docs/usage.md:
- 'cswinrt -?' -> 'cswinrtprojectionrefgen -h' for the CLI help mention.
- Updated the prose and the Mermaid edge label in the 'Generate reference projection' diagram.

docs/interop.md, docs/diagnostics/cswinrt30001.md, nuget/readme.md:
- Replaced 'cswinrt.exe' mentions with references to the CsWinRT projection writer (kept 'cswinrtinteropgen.exe' where mentioned, that tool is unchanged).

.github/skills/update-copilot-instructions/SKILL.md (per the skill's own Step 7):
- Updated the project list from 8 projects to 10.
- Replaced the 'cswinrt.exe' validation entry with 'Projection writer' + 'Reference projection generator' entries.
- Expanded the Generator tasks validation checklist to include RunCsWinRTProjectionRefGenerator and added a check that the projection generator path is documented as in-process (no cswinrt.exe subprocess).

Remaining 'cswinrt.exe' mentions in the doc tree are intentional historical context only:
- The two new sections in copilot-instructions.md and structure.md (Projection writer / Reference projection generator) reference it as 'the legacy C++ projection compiler from CsWinRT 2.x which has been deleted'.
- src/Samples/NetProjectionSample/README.md keeps an old MSB3073 error example from CsWinRT 1.4.1 - left alone since it's a verbatim historical error message.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@Sergio0694 Sergio0694 force-pushed the user/sergiopedri/cleanup-code-writers branch from 0ac5ce1 to 789191b Compare June 8, 2026 03:10
Sergio0694 and others added 2 commits June 7, 2026 20:38
Now that the C# WinRT.Internal project owns WindowsRuntime.Internal.winmd
production end-to-end and no consumer depends on the legacy cswinrt.exe
binary being built (or even present), purge every remaining reference to
the C++ tool across the codebase:

- 'nuget/Microsoft.Windows.CsWinRT.nuspec': drop the
  '<file src="$cswinrt_exe$" target="tools\win-x86"/>' entry that packaged
  cswinrt.exe into the NuGet.
- 'src/build.cmd': drop 'cswinrt_exe' variable and the
  'cswinrt_exe=%cswinrt_exe%;' parameter passed to 'nuget pack'.
- 'src/Directory.Build.props': drop '$(CsWinRTPath)' / '$(CsWinRTExe)'
  legacy build-output paths.
- 'src/WinRT.Sdk.Projection/WinRT.Sdk.Projection.csproj' and the four
  call sites in 'nuget/Microsoft.Windows.CsWinRT.CsWinRTGen.targets':
  drop the 'CsWinRTExePath="$(CsWinRTExe)"' argument passed to the
  'RunCsWinRTMergedProjectionGenerator' MSBuild task.
- 'nuget/Microsoft.Windows.CsWinRT.props': drop the '<CsWinRTExe>'
  property definition.
- 'nuget/Microsoft.Windows.CsWinRT.Authoring.targets': drop
  '<CompilerVisibleProperty Include="CsWinRTExe" />'.
- 'nuget/Microsoft.Windows.CsWinRT.targets': drop the entire dead
  response-file generation subsystem ('CsWinRTCommand',
  'CsWinRTCommandVerbosity', 'CsWinRTWindowsMetadataInput',
  'CsWinRTPublicExclusiveTo', 'CsWinRTDynamicallyInterfaceCastableExclusiveTo'
  legacy override, 'CsWinRTReferenceProjection' legacy override,
  the 'CsWinRTParams' block, the 'WriteLinesToFile' that wrote
  cswinrt.exe-style args to 'cswinrt.rsp', the 'CsWinRTResponseFile'
  property, the 'cswinrt.rsp' file used as the target's Outputs /
  'UpToDateCheckBuilt' marker, the dead 'CsWinRTCleanGenerateProjectionOutputs'
  target plus its 'CallTarget' / 'OnError' calls, and the
  'CsWinRTProjectionExitCode' output capture). The
  'RunCsWinRTProjectionRefGenerator' task constructs its own
  arguments directly, so none of this content was being consumed.
- 'src/WinRT.Generator.Tasks/RunCsWinRTMergedProjectionGenerator.cs':
  drop the 'CsWinRTExePath' property + its '[MemberNotNullWhen]'
  attribute + the 'AppendResponseFileCommand(..., "--cswinrt-exe-path", ...)'
  call. The corresponding '--cswinrt-exe-path' arg is also dropped
  from 'ProjectionGeneratorArgs.cs' / 'ProjectionGeneratorArgs.Parsing.cs'
  in 'WinRT.Projection.Generator' (the value was never consumed).
- Source-file comments: trim every '<c>cswinrt.exe</c>' / 'Mirrors the
  C++ <arg>' mention from:
  - 'src/WinRT.Runtime2/Properties/WindowsRuntimeConstants.cs' (the
    'PrivateImplementationDetailObsoleteMessage' now references
    'cswinrtprojectiongen.exe' instead).
  - 'src/WinRT.Projection.Writer/' file-header banners in emitted
    .cs files (now read 'This file was generated by C#/WinRT version ...').
  - 'src/WinRT.Projection.Writer/Helpers/SignatureGenerator.cs' xmldoc.
  - 'src/WinRT.Projection.Writer/WinRT.Projection.Writer.csproj'
    informational comment about the banner.
  - 'src/WinRT.Projection.Generator/Generation/ProjectionGenerator.cs'
    and 'ProjectionGenerator.Generate.cs' inline comments.
  - 'src/WinRT.Projection.Ref.Generator/Generation/ReferenceProjectionGenerator.cs'
    and 'ReferenceProjectionGeneratorArgs.cs' summary docs.
  - 'src/WinRT.Generator.Tasks/RunCsWinRTProjectionRefGenerator.cs'
    type doc and per-property '"Mirrors the C++ ..." doc lines.
  - 'src/WinRT.Interop.Generator/Generation/InteropGenerator.Discover.cs'
    activation-factory remarks.
- Docs cleanup: '.github/copilot-instructions.md', 'docs/structure.md',
  '.github/skills/update-copilot-instructions/SKILL.md',
  'src/Samples/NetProjectionSample/README.md', 'nuget/readme.md' now
  describe the C# projection writer / refgen tools without
  referencing the legacy C++ tool or its CLI args.
- AzurePipelines: drop the "Stage CsWinRT" task that copied
  'cswinrt.exe' / 'cswinrt.pdb' into the staging folder, remove
  'native/cswinrt.exe' from the signing list in
  'CsWinRT-BuildAndTest-Stage-OneBranch.yml', and drop the
  'cswinrt_exe=...' property from the 'nuget pack' invocation in
  'CsWinRT-PublishToNuGet-Steps.yml'.

Verified end-to-end: 'dotnet build' of both 'WinRT.Internal' (produces
'WindowsRuntime.Internal.winmd') and 'WinRT.Sdk.Projection' (consumes
that winmd via 'cswinrtprojectiongen.exe' to produce
'WinRT.Sdk.Projection.dll') both succeed with 0 warnings / 0 errors.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Update '.github/copilot-instructions.md' and the matching update skill
to reflect the current 11-project structure and the complete removal of
the legacy C++ cswinrt.exe tool from this branch.

copilot-instructions.md:
- Repository structure tree: add 'WinRT.Internal/' as project 11.
- WinRT.Runtime2 directory tree: add the actual nested subdirectories
  that were missing — 'ABI/Windows.Storage.Streams/',
  'Windows.Foundation/{Collections,Extensions,Metadata}/',
  'Windows.Storage.Streams/Extensions/',
  'Exceptions/{Microsoft.UI.Xaml,Windows.UI.Xaml}/', and inline notes for
  the second-level subdirs under 'InteropServices/{AsyncInfo,Buffers,
  Marshalling,Streams}/'.
- WinRT.SourceGenerator2 project settings: fix the documented assembly
  name from 'WinRT.SourceGenerator2' to 'WinRT.SourceGenerator' (the
  produced .dll name; the project folder retains the '2' suffix for
  repo history).
- Projection writer directory tree: add the previously missing
  top-level 'Attributes/' folder and 'Extensions/' entry.
- Projection writer "Internal interop interfaces" paragraph: rewrite
  to describe 'WindowsRuntime.Internal.winmd' as produced from the C#
  WinRT.Internal project rather than as a "separately maintained" file.
- Add a new project section "11. WinRT.Internal" describing its role
  (producer of 'WindowsRuntime.Internal.winmd'), project settings
  (TFM 'net10.0-windows10.0.26100.1', disabled CsWinRT integration,
  'IsPackable=false', pinned 'WindowsSdkPackageVersion'), contents
  (HWND struct, 'ProjectionInternalAttribute', and the 14 'I*Interop'
  C# source files), and MSBuild integration (the
  'GenerateWindowsRuntimeInternalWinMD' target invokes
  'cswinrtwinmdgen.exe' via '<Exec>' to sidestep the 'MSB3027'
  file-lock issue, and wires the output via '$(CsWinRTInteropMetadata)').
- Naming conventions: add 'WindowsRuntime.Internal' to the namespace
  list as the interop metadata authoring project.
- Other directories tests row: extend the test-project list with all
  current projects discovered under 'src/Tests/' (AuthoringWuxTest,
  AuthoringConsumptionTest, AuthoringWinUITest,
  AuthoringWuxConsumptionTest, BuildDeterminismTest, DiagnosticTests,
  RuntimeFrameworkVersion, OOPExe, HostTest), and correct
  'ObjectLifetimeTests/' to 'ObjectLifetimeTests.Lifted/'.

update-copilot-instructions/SKILL.md:
- Bump the project count in step 2 from 10 to 11.
- Add the new project 11 (WinRT.Internal) with its validation checklist.
- Add a note to project 2's checklist about the assembly-name vs
  folder-name mismatch.
- Add a note to project 3's checklist that 'Attributes/' and
  'Extensions/' are top-level dirs in the projection writer.
- Add notes to projects 6 and 9 to verify there is no leftover
  'CsWinRTExePath' field / parameter (a regression we hit during the
  cswinrt cleanup).
- Add 'SdkPackageVersion' to project 10's build parameters list.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

code cleanup Code cleanup and refactoring CsWinRT 3.0 documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant