diff --git a/.github/copilot-instructions.md b/.github/copilot-instructions.md
index 489ef7a1ae..f6581cd656 100644
--- a/.github/copilot-instructions.md
+++ b/.github/copilot-instructions.md
@@ -34,13 +34,15 @@ CsWinRT/
│ ├── WinRT.Runtime2/ # (1) Runtime library (WinRT.Runtime.dll)
│ ├── Authoring/
│ │ └── WinRT.SourceGenerator2/ # (2) Roslyn source generator + analyzers
-│ ├── cswinrt/ # (3) C++ code generator (cswinrt.exe)
-│ ├── WinRT.Impl.Generator/ # (4) Impl/forwarder DLL generator (cswinrtimplgen.exe)
-│ ├── WinRT.Projection.Generator/ # (5) Projection DLL generator (cswinrtprojectiongen.exe)
-│ ├── WinRT.Interop.Generator/ # (6) Interop sidecar generator (cswinrtinteropgen.exe)
-│ ├── WinRT.WinMD.Generator/ # (7) Component .winmd generator (cswinrtwinmdgen.exe)
-│ ├── WinRT.Generator.Tasks/ # (8) MSBuild tasks for the build tools
-│ └── WinRT.Sdk.Projection/ # (9) Precompiled Windows SDK projection builds
+│ ├── WinRT.Projection.Writer/ # (3) Projection writer library (C# code writers)
+│ ├── WinRT.Projection.Ref.Generator/ # (4) Reference projection source generator (cswinrtprojectionrefgen.exe)
+│ ├── WinRT.Impl.Generator/ # (5) Impl/forwarder DLL generator (cswinrtimplgen.exe)
+│ ├── WinRT.Projection.Generator/ # (6) Projection DLL generator (cswinrtprojectiongen.exe)
+│ ├── WinRT.Interop.Generator/ # (7) Interop sidecar generator (cswinrtinteropgen.exe)
+│ ├── WinRT.WinMD.Generator/ # (8) Component .winmd generator (cswinrtwinmdgen.exe)
+│ ├── WinRT.Generator.Tasks/ # (9) MSBuild tasks for the build tools
+│ ├── WinRT.Sdk.Projection/ # (10) Precompiled Windows SDK projection builds
+│ └── WinRT.Internal/ # (11) WindowsRuntime.Internal.winmd authoring project
├── nuget/ # MSBuild .props/.targets for NuGet package
├── docs/ # Specifications and documentation
└── eng/ # Engineering/CI infrastructure
@@ -55,7 +57,7 @@ graph TD
subgraph NUGET ["WinRT component NuGet package"]
direction TB
WINMD[".winmd metadata"]
- CSWINRT["cswinrt.exe (CsWinRTGenerateProjection target)"]
+ CSWINRT["cswinrtprojectionrefgen.exe (CsWinRTGenerateProjection target)"]
CS_SOURCES["Generated C# sources"]
CSC_LIB["csc.exe (compiles projection .csproj)"]
REF_ASM["Reference assembly (public API surface only)"]
@@ -95,7 +97,9 @@ graph TD
IMPL_DLL -.->|"referenced by app"| MY_DLL
```
-> **Precompiled SDK projections:** To speed up builds, the CsWinRT NuGet package includes precompiled `WinRT.Sdk.Projection.dll` and `WinRT.Sdk.Xaml.Projection.dll` binaries for all supported Windows SDK versions. When the CsWinRT version matches the target Windows SDK version (which is the normal case, except when using a Windows SDK preview), the projection generator skips regenerating these .dll-s entirely and uses the precompiled ones instead. This avoids the cost of running cswinrt.exe + Roslyn compilation for the entire Windows SDK on every publish.
+> **Shared projection writer:** Both `cswinrtprojectionrefgen.exe` (used at component-library build time) and `cswinrtprojectiongen.exe` (used at app publish time) drive the same internal `WinRT.Projection.Writer` library to translate `.winmd` metadata into C# projection sources. The writer is consumed in-process by both tools, so there is no separate "projection compiler" executable to invoke.
+
+> **Precompiled SDK projections:** To speed up builds, the CsWinRT NuGet package includes precompiled `WinRT.Sdk.Projection.dll` and `WinRT.Sdk.Xaml.Projection.dll` binaries for all supported Windows SDK versions. When the CsWinRT version matches the target Windows SDK version (which is the normal case, except when using a Windows SDK preview), the projection generator skips regenerating these .dll-s entirely and uses the precompiled ones instead. This avoids the cost of running the projection writer + Roslyn compilation for the entire Windows SDK on every publish.
---
@@ -145,7 +149,7 @@ By running the interop generator at the very end of the build process (after all
| Property | Default | Description |
|----------|---------|-------------|
| `CsWinRTEnabled` | `true` | Master switch for CsWinRT processing |
-| `CsWinRTGenerateProjection` | `true` | Run cswinrt.exe to generate C# projection code |
+| `CsWinRTGenerateProjection` | `true` | Run `cswinrtprojectionrefgen` to generate C# projection sources for the current project |
| `CsWinRTGenerateInteropAssembly2` | auto (`true` for Exe/WinExe, or Library with `PublishAot=true`) | Generate interop assemblies at publish time |
| `CsWinRTGenerateReferenceProjection` | `false` | Generate reference-only projections (for NuGet packages) |
| `CsWinRTComponent` | `false` | Enable Windows Runtime component authoring mode |
@@ -178,33 +182,42 @@ WinRT.Runtime2/
├── ABI/ # ABI type mappings (managed ↔ native)
│ ├── System/ # Primitives, String, Uri, DateTimeOffset, collections, etc.
│ ├── Windows.Foundation/ # Foundation types (Point, Rect, Size, etc.)
+│ ├── Windows.Storage.Streams/ # Stream ABI mappings
│ └── WindowsRuntime.InteropServices/ # Bindable adapters
├── Attributes/ # Public marker attributes (e.g. [WindowsRuntimeClassName])
-├── InteropServices/ # Core interop infrastructure (~456 files)
+├── InteropServices/ # Core interop infrastructure
│ ├── Activation/ # Object activation factories and helpers
-│ ├── AsyncInfo/ # Async operation marshalling
+│ ├── AsyncInfo/ # Async operation marshalling (Adapters/, Helpers/, TaskCompletionSources/)
+│ ├── Attributes/ # Internal attributes consumed by the interop stack
+│ ├── Bindables/ # XAML data-binding bridge types
+│ ├── Buffers/ # IBuffer / Span marshalling helpers (MemoryStreams/)
│ ├── Callbacks/ # ComWrappers callbacks
│ ├── Collections/ # Collection adapters (IList↔IVector, IDictionary↔IMap, etc.)
+│ ├── Dispatching/ # DispatcherQueueSynchronizationContext and dispatcher integration
│ ├── Events/ # Event source infrastructure (EventSource, tokens)
│ ├── Exceptions/ # Exception ↔ HRESULT marshalling
+│ ├── Extensions/ # Public extension methods on projected types
│ ├── InteropDllImports/ # P/Invoke declarations
│ ├── Marshalers/ # Type marshallers (string, delegate, value type, etc.)
-│ ├── Marshalling/ # High-level marshalling APIs (WindowsRuntimeObjectMarshaller, etc.)
+│ ├── Marshalling/ # High-level marshalling APIs (Collections/, SzArrays/)
│ ├── ObjectReference/ # Native object lifetime (WindowsRuntimeObjectReference hierarchy)
+│ ├── Placeholders/ # Placeholder types for unresolved generic instantiations
│ ├── Platform/ # Platform types (HRESULT, HSTRING, etc.)
+│ ├── ProjectionDllExports/ # Reserved DLL entry points consumed by the generated projection
│ ├── ProjectionImpls/ # Built-in interface implementations (IStringable, IPropertyValue, etc.)
+│ ├── Streams/ # IRandomAccessStream / Stream interop (Adapters/, Operations/)
+│ ├── System.Runtime.InteropServices/ # Custom interop attributes added to the BCL surface
│ ├── TypeMapGroups/ # Type mapping group markers for ComWrappers
│ ├── TypeMapInfo/ # Type metadata caching
-│ ├── Vtables/ # COM vtable struct definitions (37 vtable types)
+│ ├── Vtables/ # COM vtable struct definitions
│ └── WeakReferences/ # Weak reference support
├── NativeObjects/ # Managed wrappers for native Windows Runtime objects (collections, async, etc.)
-├── Windows.Foundation/ # Manually projected foundation types
-├── Windows.Foundation.Collections/ # Collection interfaces (IObservableVector, IObservableMap, etc.)
-├── Windows.Storage.Streams/ # Manually projected stream types
+├── Windows.Foundation/ # Manually projected foundation types (Collections/, Extensions/, Metadata/)
+├── Windows.Storage.Streams/ # Manually projected stream types (Extensions/)
├── Windows.UI.Xaml.Interop/ # Manually projected XAML interop types
├── Xaml.Attributes/ # XAML-related attribute types
├── Properties/ # Exception messages and configuration (e.g. feature switches)
-└── Exceptions/ # Exception types
+└── Exceptions/ # Exception types (Microsoft.UI.Xaml/, Windows.UI.Xaml/)
```
**Key types:**
@@ -230,7 +243,7 @@ WinRT.Runtime2/
**Types projected in WinRT.Runtime:**
-Not all WinRT types are generated automatically by `cswinrt.exe` into SDK projection assemblies. `WinRT.Runtime` contains two categories of types that require special handling:
+Not all WinRT types are generated automatically by the projection writer into SDK projection assemblies. `WinRT.Runtime` contains two categories of types that require special handling:
#### Custom-mapped types
@@ -283,7 +296,7 @@ The full mapping table (including identical-name mappings for primitives) is in
#### Manually-projected types
-These are WinRT types that are defined directly in `WinRT.Runtime` rather than being auto-generated by `cswinrt.exe` into SDK projection assemblies. A type is manually projected when it requires customized marshalling support, or when it is referenced by additional infrastructure code that lives in `WinRT.Runtime`. For example:
+These are WinRT types that are defined directly in `WinRT.Runtime` rather than being auto-generated by the projection writer into SDK projection assemblies. A type is manually projected when it requires customized marshalling support, or when it is referenced by additional infrastructure code that lives in `WinRT.Runtime`. For example:
- **Generic collection interfaces** (`IEnumerable`, `IList`, `IDictionary`, etc.) are here so that supporting adapter code (e.g. `IListAdapter`, `IEnumerableMethods`) and native object wrappers can live alongside them and be consumed by both projections and the interop generator.
- **Async interfaces** (`IAsyncOperation`, `IAsyncActionWithProgress`, etc.) and their associated delegates are here to provide the async infrastructure (`AsyncInfo`, `EventSource` specializations) that bridges WinRT async patterns to `Task`.
@@ -300,7 +313,7 @@ A Roslyn incremental source generator and diagnostic analyzer package. Runs at *
- **Target**: `net10.0`, C# 14, `IsRoslynComponent = true`
- **Root namespace**: `WindowsRuntime.SourceGenerator`
-- **Assembly name**: `WinRT.SourceGenerator2`
+- **Assembly name**: `WinRT.SourceGenerator`
- **Dependency**: `Microsoft.CodeAnalysis.CSharp` 5.0.0
**Three source generators:**
@@ -311,7 +324,7 @@ A Roslyn incremental source generator and diagnostic analyzer package. Runs at *
| `CustomPropertyProviderGenerator` | `ICustomPropertyProvider` implementations for XAML data binding. Annotate types with `[GeneratedCustomPropertyProvider]` to auto-generate property accessors. Supports both UWP and WinUI XAML. |
| `TypeMapAssemblyTargetGenerator` | `[TypeMapAssemblyTarget]` assembly attributes for runtime type mapping in AOT scenarios. Discovers referenced Windows Runtime assemblies and registers them with the three type map groups: `WindowsRuntimeComWrappersTypeMapGroup`, `WindowsRuntimeMetadataTypeMapGroup`, `DynamicInterfaceCastableImplementationTypeMapGroup`. |
-**Four diagnostic analyzers** producing 9 diagnostics (all errors, IDs `CSWINRT2000`–`CSWINRT2008`):
+**Five diagnostic analyzers** producing 10 diagnostics (IDs `CSWINRT2000`–`CSWINRT2009`; the first nine are errors, the last is a warning):
Validate `[GeneratedCustomPropertyProvider]` usage:
@@ -321,38 +334,80 @@ Validate `[GeneratedCustomPropertyProvider]` usage:
- `CSWINRT2003`: Type already implements `ICustomPropertyProvider` members
- `CSWINRT2004`–`CSWINRT2008`: Invalid attribute arguments (null names, missing properties/indexers, static indexers)
-### 3. cswinrt.exe (`src/cswinrt/`)
+Validate general projection usage:
-A **C++ command-line tool** that reads `.winmd` metadata files and generates C# projection source code for Windows Runtime types. It uses the [WinMD NuGet package](http://aka.ms/winmd/nuget) for parsing [ECMA-335 metadata](http://www.ecma-international.org/publications/standards/Ecma-335.htm) files.
+- `CSWINRT2009`: Cast to a `[ComImport]` interface type is not supported under CsWinRT 3.0 (`ComImportInterfaceAnalyzer`)
-**Key files:**
+### 3. Projection writer (`src/WinRT.Projection.Writer/`)
-| File | Purpose |
-|------|---------|
-| `main.cpp` | Entry point: parses args, loads metadata, orchestrates parallel namespace generation |
-| `settings.h` | Command-line option definitions (`--input`, `--output`, `--include`, `--exclude`, `--reference_projection`, etc.) |
-| `code_writers.h` | Primary code generation logic (~456 KB). Contains `write_class()`, `write_interface()`, `write_struct()`, `write_enum()`, `write_delegate()` and their ABI counterparts |
-| `type_writers.h` | Type name writing utilities, generic argument tracking |
-| `helpers.h` | Type categorization utilities (`is_static()`, `is_type_blittable()`, `get_default_interface()`, etc.) |
-| `strings/` | Embedded C# code injected into output (additions for specific namespaces) |
+The **projection writer** is a C# library that reads `.winmd` metadata and generates C# projection source code for Windows Runtime types. The writer ships as a library so the same code path is reused by both the reference projection generator (component build time) and the merged projection generator (app publish time).
+
+**Project settings:**
-**Input/Output:**
+- **Target**: `net10.0`, C# 14, `AllowUnsafeBlocks`, `DisableRuntimeMarshalling`, `IsAotCompatible`
+- **Root namespace**: `WindowsRuntime.ProjectionWriter`
+- **Assembly name**: `WinRT.Projection.Writer`
+- **Dependency**: `AsmResolver.DotNet` (for `.winmd` parsing and IL/metadata helpers)
+- **Public surface**: a single static `ProjectionWriter.Run(ProjectionWriterOptions)` entry point. `ProjectionWriterOptions` exposes input metadata paths, output folder, include/exclude filters, component/reference-projection/exclusive-to toggles, a logger callback, a `MaxDegreesOfParallelism` knob, and a `CancellationToken`.
+
+**Public API model:**
+
+The writer is consumed by other generators as a plain library reference — no inter-process invocation, no response file required at this boundary. The two consuming tools (`cswinrtprojectionrefgen` and `cswinrtprojectiongen`) parse their own response files, translate them into `ProjectionWriterOptions`, and call `ProjectionWriter.Run` directly.
+
+**Directory structure:**
```
-cswinrt.exe --input <.winmd files/dirs> --output [--include/--exclude prefixes]
- [--reference_projection] [--component] [--internal] [--embedded]
+WinRT.Projection.Writer/
+├── ProjectionWriter.cs # Public Run(ProjectionWriterOptions) entry point
+├── ProjectionWriterOptions.cs # Public options record
+├── Attributes/ # Internal attributes consumed by the writer
+├── Builders/ # Per-file emission orchestrators
+├── Errors/ # WellKnownProjectionWriterException + Unhandled* (5xxx error IDs)
+├── Extensions/ # AsmResolver / type-classifier extensions
+├── Factories/ # ABI/projection class/interface/struct/enum/delegate factories
+├── Generation/ # ProjectionGenerator orchestrator (per-namespace work items)
+├── Helpers/ # Shared emission helpers (type names, IDs, signatures, blittability)
+├── Metadata/ # MetadataCache, TypeSemantics, NamespaceMembers
+├── Models/ # TypeKind, AbiTypeKind, MethodSignatureInfo, ParameterCategory, etc.
+├── References/ # Well-known namespaces / attribute names / type names
+├── Resolvers/ # TypeKindResolver, AbiTypeKindResolver, ParameterCategoryResolver, ...
+├── Resources/ # Embedded baseline + per-namespace addition .cs files
+│ ├── Additions/ # - One folder per WinRT namespace with hand-written add-on members
+│ └── Base/ # - Always-emitted baseline: ComInteropExtensions, InspectableVftbl, ReferenceInterfaceEntries
+└── Writers/ # IndentedTextWriter (with interpolated-string + callback handlers) + supporting types
```
-**Generates two layers of C# code per Windows Runtime type:**
+**Generated output (per Windows Runtime type):**
-1. **Projected types** (public API): the user-facing C# classes, interfaces, structs, enums, and delegates that developers use directly. Runtime classes inherit `WindowsRuntimeObject`.
+1. **Projected types** (public API): user-facing C# classes, interfaces, structs, enums, and delegates. Runtime classes inherit `WindowsRuntimeObject`.
2. **ABI layer** (`namespace ABI.{Namespace}`): internal marshalling infrastructure — vtable definitions (structs with unmanaged function pointers), interface method implementations, marshaller classes.
-**Namespace additions** (`strings/additions/`): extra C# code injected into specific namespaces (e.g. `Color.FromArgb()` for `Windows.UI`, XAML struct helpers for `Thickness`, `CornerRadius`, `GridLength`, etc.).
+**Namespace additions** (`Resources/Additions/`): hand-authored C# snippets injected into specific namespaces (e.g. `Color.FromArgb()` for `Windows.UI`, XAML struct helpers for `Thickness`, `CornerRadius`, `GridLength`, etc.). Both WinUI (`Microsoft.UI.Xaml`) and UWP (`Windows.UI.Xaml`) variants are present.
+
+**Baseline emission** (`Resources/Base/`): always-emitted files that are not derived from `.winmd` metadata — `ComInteropExtensions.cs` (user-friendly extension methods wrapping internal interop interfaces), `InspectableVftbl.cs` (cached `IInspectable` vtable shape), `ReferenceInterfaceEntries.cs` (CCW interface entry table for the unknown-object fallback).
+
+**Internal interop interfaces** (`WindowsRuntime.Internal.winmd`): a small set of Windows SDK COM interop interfaces (e.g. `IDisplayInformationStaticsInterop`, `IPrintManagerInterop`) that are not included in standard SDK metadata. The .winmd is produced from the C# `WinRT.Internal` project (see project 11 below); it is bundled in the CsWinRT NuGet package (`metadata/WindowsRuntime.Internal.winmd`) and added as additional input to the projection writer when building Windows SDK projections. Interfaces in this metadata carry the `[ProjectionInternal]` attribute, which causes all generated projection code for them to be emitted `internal`. The hand-written extension methods in `Resources/Base/ComInteropExtensions.cs` then surface user-friendly wrappers on the associated projected types (e.g. `DisplayInformation.GetForWindow(hwnd)`, `PrintManager.ShowPrintUIForWindowAsync(hwnd)`).
+
+### 4. Reference projection generator (`src/WinRT.Projection.Ref.Generator/`)
+
+A **.NET CLI tool** (`cswinrtprojectionrefgen.exe`) published as a **Native AOT** binary. It drives the projection writer in-process from the `CsWinRTGenerateProjection` MSBuild target. The tool runs at component-library build time and writes `.cs` files into the user's `$(IntermediateOutputPath)`, which `csc.exe` then compiles into the user library/component `.dll`.
+
+**Project settings:**
+
+- **Target**: `net10.0`, C# 14, `PublishAot = true`, `DisableRuntimeMarshalling`
+- **Root namespace**: `WindowsRuntime.ReferenceProjectionGenerator`
+- **Assembly name**: `cswinrtprojectionrefgen`
+- **Dependencies**: `ConsoleAppFramework` (CLI), and a project reference to `WinRT.Projection.Writer`
+- **Security**: Control Flow Guard enabled, `IlcResilient = false`
+
+**Two-step flow:**
+
+1. **Parse**: read the response file produced by the `CsWinRTGenerateProjection` MSBuild target, validate the target framework is `net10.0+`, and translate the parsed `ReferenceProjectionGeneratorArgs` into a `ProjectionWriterOptions` instance.
+2. **Generate**: invoke `ProjectionWriter.Run(options)` in-process. The writer emits the projection sources into the configured output folder.
-**Internal interop interfaces** (`WindowsRuntime.Internal.idl`): a manually authored IDL file defining Windows SDK COM interop interfaces (e.g. `IDisplayInformationStaticsInterop`, `IPrintManagerInterop`) that are not included in standard `.winmd` metadata. This IDL is compiled to a `.winmd` that is bundled in the CsWinRT NuGet package and passed as additional input to cswinrt.exe when building Windows SDK projections. The `[ProjectionInternal]` attribute on each interface causes all generated projection code to be `internal`. User-friendly extension methods in `strings/ComInteropExtensions.cs` wrap these internal projections, exposing discoverable APIs on the associated projected types (e.g. `DisplayInformation.GetForWindow(hwnd)`, `PrintManager.ShowPrintUIForWindowAsync(hwnd)`).
+The tool is wired through the `RunCsWinRTProjectionRefGenerator` MSBuild task (in `WinRT.Generator.Tasks`).
-### 4. Impl generator (`src/WinRT.Impl.Generator/`)
+### 5. Impl generator (`src/WinRT.Impl.Generator/`)
A **.NET CLI tool** (`cswinrtimplgen.exe`) published as a **Native AOT** binary. Generates **forwarder/impl assemblies** that contain only type forwards (no actual code).
@@ -380,15 +435,15 @@ A **.NET CLI tool** (`cswinrtimplgen.exe`) published as a **Native AOT** binary.
4. Emits `[TypeForwarder]` entries for all public top-level types, routing to the appropriate projection assembly
5. Optionally signs with a strong-name key
-### 5. Projection generator (`src/WinRT.Projection.Generator/`)
+### 6. Projection generator (`src/WinRT.Projection.Generator/`)
-A **.NET CLI tool** (`cswinrtprojectiongen.exe`) published as a **Native AOT** binary. Takes `.winmd` files as input, invokes `cswinrt.exe` to generate C# sources, then compiles them into a projection `.dll` using the Roslyn APIs.
+A **.NET CLI tool** (`cswinrtprojectiongen.exe`) published as a **Native AOT** binary. Runs at **app build / publish time** to produce a single projection `.dll` for the Windows SDK, the UWP XAML SDK, or all third-party Windows Runtime components referenced by the app. The tool drives the projection writer in-process and then compiles the resulting C# sources with Roslyn.
**Project settings:**
- **Target**: `net10.0`, `PublishAot = true`, `DisableRuntimeMarshalling`
- **Assembly name**: `cswinrtprojectiongen`
-- **Dependencies**: `AsmResolver.DotNet`, `ConsoleAppFramework`, `Microsoft.CodeAnalysis.CSharp` (Roslyn)
+- **Dependencies**: `ConsoleAppFramework`, `Microsoft.CodeAnalysis.CSharp` (Roslyn), and a project reference to `WinRT.Projection.Writer`
**Three projection modes:**
@@ -400,11 +455,11 @@ A **.NET CLI tool** (`cswinrtprojectiongen.exe`) published as a **Native AOT** b
**Three-phase pipeline:**
-1. **Process References**: load reference assemblies via AsmResolver, generate `.rsp` response file with namespace filters
-2. **Generate Sources**: invoke `cswinrt.exe @response.rsp` to produce C# files
-3. **Emit Assembly**: parse generated `.cs` files with Roslyn, compile to `.dll` with `CSharpCompilation`, emit with embedded debug info
+1. **Process References**: load reference assemblies via AsmResolver, build a `ProjectionWriterOptions` describing the inputs, output folder, and namespace filters.
+2. **Generate Sources**: invoke `ProjectionWriter.Run(options)` in-process to produce C# files.
+3. **Emit Assembly**: parse the generated `.cs` files with Roslyn, compile to `.dll` with `CSharpCompilation`, emit with embedded debug info.
-### 6. Interop generator (`src/WinRT.Interop.Generator/`)
+### 7. Interop generator (`src/WinRT.Interop.Generator/`)
A **.NET CLI tool** (`cswinrtinteropgen.exe`) published as a **Native AOT** binary. This is the most complex build tool — it analyzes all application assemblies and produces the `WinRT.Interop.dll` sidecar containing all marshalling code.
@@ -440,7 +495,7 @@ There's two reasons for this:
**Debug repro support**: can capture all inputs into a `.zip` file for reproducible debugging.
-### 7. WinMD generator (`src/WinRT.WinMD.Generator/`)
+### 8. WinMD generator (`src/WinRT.WinMD.Generator/`)
A **.NET CLI tool** (`cswinrtwinmdgen.exe`) published as a **Native AOT** binary. Generates a `.winmd` metadata file from a compiled C# component assembly, allowing developers to author Windows Runtime components in C#. This is a port and restructuring of the previous WinMD generator from CsWinRT 2.x, which was implemented as a Roslyn source generator. Moving it to a post-build CLI tool keeps it consistent with the other CsWinRT 3.0 build tools (interop, impl, projection generators) and removes the design-time/IntelliSense overhead of analyzing the entire component at every keystroke. It also addresses a more fundamental issue with the 2.x design: the generator produced a `.winmd` file **on disk**, but doing arbitrary file I/O from a Roslyn source generator is explicitly unsupported (source generators are only allowed to contribute additional source code to the compilation). The 2.x approach was therefore technically not even supported. The 3.0 post-build tool runs as a normal MSBuild step where file I/O is the expected output mechanism.
@@ -485,7 +540,7 @@ WinRT.WinMD.Generator/
- Runs after `CoreCompile` (it needs the compiled .dll), gated on `CsWinRTComponent == true` and `DesignTimeBuild != true`
- Output is `$(IntermediateOutputPath)$(AssemblyName).winmd`, then copied to `$(TargetDir)` by the authoring targets and packaged into the component's NuGet
-### 8. Generator tasks (`src/WinRT.Generator.Tasks/`)
+### 9. Generator tasks (`src/WinRT.Generator.Tasks/`)
MSBuild task wrappers that bridge the MSBuild build system with the CLI tools above.
@@ -494,10 +549,11 @@ MSBuild task wrappers that bridge the MSBuild build system with the CLI tools ab
- **Target**: `netstandard2.0` (for MSBuild compatibility)
- **Dependency**: `Microsoft.Build.Utilities.Core`
-**Four tasks:**
+**Five tasks:**
| Task Class | Tool | Purpose |
|------------|------|---------|
+| `RunCsWinRTProjectionRefGenerator` | `cswinrtprojectionrefgen.exe` | Generate reference projection C# sources (component-library build time) |
| `RunCsWinRTForwarderImplGenerator` | `cswinrtimplgen.exe` | Generate forwarder/impl assemblies |
| `RunCsWinRTMergedProjectionGenerator` | `cswinrtprojectiongen.exe` | Generate merged projection assemblies |
| `RunCsWinRTInteropGenerator` | `cswinrtinteropgen.exe` | Generate interop sidecar assembly |
@@ -505,7 +561,7 @@ MSBuild task wrappers that bridge the MSBuild build system with the CLI tools ab
All tasks extend `ToolTask`, generate response files for their respective CLI tools, and support architecture selection (`win-x86`, `win-x64`, `win-arm64`).
-### 9. SDK projection builds (`src/WinRT.Sdk.Projection/`)
+### 10. SDK projection builds (`src/WinRT.Sdk.Projection/`)
A build project (not a tool) used during **official CsWinRT builds** to produce precompiled `WinRT.Sdk.Projection.dll` and `WinRT.Sdk.Xaml.Projection.dll` for each supported Windows SDK version. These precompiled .dll-s are bundled into the CsWinRT NuGet package so that consumers don't have to regenerate the entire Windows SDK projection on every publish (as described in the architecture overview).
@@ -523,6 +579,30 @@ A build project (not a tool) used during **official CsWinRT builds** to produce
- Output goes to a per-SDK-version subdirectory (`bin/{Configuration}/{WindowsSdkBuild}/`)
- Built twice per SDK version: once for the base projection (`WinRT.Sdk.Projection.dll`) and once with `WindowsSdkXaml=true` for the XAML projection (`WinRT.Sdk.Xaml.Projection.dll`)
+### 11. WinRT.Internal (`src/WinRT.Internal/`)
+
+A small build project that produces **`WindowsRuntime.Internal.winmd`** — the Windows SDK COM interop interface metadata bundled with the CsWinRT NuGet package and consumed by the projection writer when building Windows SDK projections (see "Internal interop interfaces" under the Projection writer section above).
+
+**Project settings:**
+
+- **Target**: `net10.0-windows10.0.26100.1` (the `.1` TFM revision selects the `cswinrt3` Windows SDK projection reference assemblies, which carry `[WindowsRuntimeMetadata]` attributes the WinMD generator reads)
+- **Assembly name**: `WindowsRuntime.Internal`
+- **Nullable**: `disable` (the Windows Runtime type system does not support nullability annotations)
+- **WindowsSdkPackageVersion**: pinned (e.g. `10.0.26100.85-preview`) so the .NET SDK adds the implicit framework reference to the matching `Microsoft.Windows.SDK.NET.Ref` package
+- **Disabled CsWinRT integration**: `CsWinRTEnabled = false`, `CsWinRTGenerateProjection = false`, `CsWinRTGenerateInteropAssembly[2] = false` (this project itself feeds back into the CsWinRT pipeline; no NuGet `Microsoft.Windows.CsWinRT` reference is involved)
+- **`IsPackable = false`**: the produced `.dll` is just an intermediate artifact; only the `.winmd` is shipped
+- References `WinRT.Runtime2` via `ProjectReference Private="false"` and depends on `WinRT.WinMD.Generator` for build ordering only (`ReferenceOutputAssembly="false"`)
+
+**Contents:**
+
+- **`HWND.cs`**: struct counterpart of the IDL `HWND` (custom-mapped to `nint` by the projection writer)
+- **`ProjectionInternalAttribute.cs`**: forward declaration of the `[ProjectionInternal]` marker the projection writer reads to emit `internal` projections
+- **14 `I*Interop.cs` files**: one per interop interface (`IAccountsSettingsPaneInterop`, `IDragDropManagerInterop`, `IInputPaneInterop`, `IPlayToManagerInterop`, `IPrintManagerInterop`, `IRadialControllerInterop`, `IRadialControllerConfigurationInterop`, `IRadialControllerIndependentInputSourceInterop`, `ISpatialInteractionManagerInterop`, `ISystemMediaTransportControlsInterop`, `IUIViewSettingsInterop`, `IUserConsentVerifierInterop`, `IWebAuthenticationCoreManagerInterop`, `IDisplayInformationStaticsInterop`) with their original IIDs and method signatures referencing Windows SDK projection types (e.g. `Windows.UI.ApplicationSettings.AccountsSettingsPane`)
+
+**MSBuild integration:**
+
+The project's own `GenerateWindowsRuntimeInternalWinMD` target runs after `CoreCompile` and invokes `cswinrtwinmdgen.exe` directly via `` (not via the `RunCsWinRTWinMDGenerator` MSBuild task) to avoid `MSB3027` file-lock contention from the persistent MSBuild build server keeping `WinRT.Generator.Tasks.dll` loaded. A response file in `$(IntermediateOutputPath)` is generated via `` and passed as `@`. The output `.winmd` is written to `$(TargetDir)$(AssemblyName).winmd` (i.e. `WindowsRuntime.Internal.winmd` next to the project's `.dll`), and `src/Directory.Build.props` points `$(CsWinRTInteropMetadata)` at that path so downstream consumers (notably `WinRT.Sdk.Projection`) pick it up.
+
---
## NuGet package build pipeline (`nuget/`)
@@ -531,13 +611,14 @@ The MSBuild integration is orchestrated through several `.props` and `.targets`
| File | Role |
|------|------|
-| `Microsoft.Windows.CsWinRT.props` | Initial setup: sets `CsWinRTPath`, `CsWinRTExe`, `UsingCsWinRT3` flag |
+| `Microsoft.Windows.CsWinRT.props` | Initial setup: sets `CsWinRTPath`, `UsingCsWinRT3` flag, and the `BeforeMicrosoftNETSdkTargets` chain |
| `Microsoft.Windows.CsWinRT.BeforeMicrosoftNetSdk.targets` | Pre-SDK configuration: reference projection mode, activation factory merging, stub exe setup |
-| `Microsoft.Windows.CsWinRT.targets` | Main pipeline: projection generation (cswinrt.exe), reference setup, compilation integration |
+| `Microsoft.Windows.CsWinRT.targets` | Main pipeline: invokes `cswinrtprojectionrefgen` for `CsWinRTGenerateProjection`, sets up reference inclusion, integrates with `CoreCompile` |
| `Microsoft.Windows.CsWinRT.CsWinRTGen.targets` | Post-build tools: interop generation, impl generation, merged projection generation |
| `Microsoft.Windows.CsWinRT.Authoring.targets` | Windows Runtime component authoring: managed DLL output, WinMD generation, NuGet packaging |
| `Microsoft.Windows.CsWinRT.Authoring.Transitive.targets` | Transitive target rules for component consumers |
| `Microsoft.Windows.CsWinRT.Authoring.WinMD.targets` | Component `.winmd` generation: invokes `cswinrtwinmdgen.exe` after `CoreCompile` (only when `CsWinRTComponent == true`) |
+| `Microsoft.Windows.CsWinRT.Native.targets` | Imported by native (C++) `.vcxproj` consumers of C# WinRT components: detects component project references and generates `WinRT.Component.dll` + `WinRT.Interop.dll` for JIT hosting (gated on `CsWinRTDisableNativeComponentInterop != 'true'`) |
---
@@ -557,26 +638,21 @@ The MSBuild integration is orchestrated through several `.props` and `.targets`
- **Suppressed warnings**: `CS8500` (ref safety in unsafe contexts), `AD0001` (analyzer crashes), `CSWINRT3001` (obsolete internal members)
- **Strong-name signing**: all assemblies signed with `src/WinRT.Runtime2/key.snk`
-### C++ project (cswinrt)
-
-- Warnings treated as errors (`TreatWarningAsError = true`)
-- Uses precompiled headers (`pch.h`/`pch.cpp`)
-- Character set: Unicode
-- Subsystem: Console
-
### Naming conventions
- C# namespaces follow the `WindowsRuntime.*` pattern (root namespace: `WindowsRuntime`)
- `WindowsRuntime.InteropServices` for interop infrastructure
- `WindowsRuntime.SourceGenerator` for the source generator
- - `WindowsRuntime.ImplGenerator`, `WindowsRuntime.ProjectionGenerator`, `WindowsRuntime.InteropGenerator`, `WindowsRuntime.WinMDGenerator` for build tools
+ - `WindowsRuntime.ProjectionWriter` for the projection writer library
+ - `WindowsRuntime.ReferenceProjectionGenerator`, `WindowsRuntime.ProjectionGenerator`, `WindowsRuntime.ImplGenerator`, `WindowsRuntime.InteropGenerator`, `WindowsRuntime.WinMDGenerator` for build tools
+ - `WindowsRuntime.Internal` for the interop metadata authoring project (produces `WindowsRuntime.Internal.winmd`)
- ABI types live under `ABI.{OriginalNamespace}` (e.g., `ABI.System.Collections.Generic`)
-- CLI tool assembly names are short: `cswinrt`, `cswinrtimplgen`, `cswinrtprojectiongen`, `cswinrtinteropgen`, `cswinrtwinmdgen`
+- CLI tool assembly names are short: `cswinrtprojectionrefgen`, `cswinrtprojectiongen`, `cswinrtimplgen`, `cswinrtinteropgen`, `cswinrtwinmdgen`
- C# keywords in generated identifiers are escaped with `@` prefix
### Build tool patterns
-All four .NET build tools (`cswinrtimplgen`, `cswinrtprojectiongen`, `cswinrtinteropgen`, `cswinrtwinmdgen`) share common patterns:
+All five .NET build tools (`cswinrtprojectionrefgen`, `cswinrtprojectiongen`, `cswinrtimplgen`, `cswinrtinteropgen`, `cswinrtwinmdgen`) share common patterns:
- Published as **Native AOT** self-contained binaries for fast startup
- Use **ConsoleAppFramework** for CLI argument parsing
@@ -592,11 +668,13 @@ All four .NET build tools (`cswinrtimplgen`, `cswinrtprojectiongen`, `cswinrtint
| Project | Error ID Pattern | Range |
|---------|-----------------|-------|
-| Source Generator | `CSWINRT2xxx` | `CSWINRT2000`–`CSWINRT2008` |
-| Impl Generator | `CSWINRTIMPLGENxxxx` | `0001`–`0010`, `9999` |
-| Projection Generator | `CSWINRTPROJECTIONGENxxxx` | `0001`–`0008`, `9999` |
-| Interop Generator | `CSWINRTINTEROPGENxxxx` | Various, `9999` |
-| WinMD Generator | `CSWINRTWINMDGENxxxx` | `0001`–`0007` |
+| Source Generator | `CSWINRT2xxx` | `CSWINRT2000`–`CSWINRT2009` |
+| Reference Projection Generator | `CSWINRTPROJECTIONREFGENxxxx` | `0001`–`0005`, `9999` |
+| Projection Generator (host) | `CSWINRTPROJECTIONGENxxxx` | `0001`–`0008`, `9999` |
+| Projection Writer (library) | `CSWINRTPROJECTIONGEN5xxx` | `5003`–`5021`, `9999` (shares the `CSWINRTPROJECTIONGEN` prefix with the host; the writer reserves the 5000+ range so the two never collide) |
+| Impl Generator | `CSWINRTIMPLGENxxxx` | `0001`–`0014`, `9999` |
+| Interop Generator | `CSWINRTINTEROPGENxxxx` | `0001`–`0097`, `9999` |
+| WinMD Generator | `CSWINRTWINMDGENxxxx` | `0001`–`0007`, `9999` |
| Runtime (obsolete markers) | `CSWINRT3xxx` | `CSWINRT3001` |
---
@@ -638,7 +716,7 @@ Assembly-level `[TypeMapAssemblyTarget]` attributes (generated by the source gen
| `src/Benchmarks/` | BenchmarkDotNet project for tracking performance of projection scenarios (e.g. async, events, QueryInterface, GUIDs). |
| `src/Projections/` | Projects that generate and build projections from the Windows SDK, WinUI, and test metadata. **For local development and testing only** — these are not shipped in the NuGet package. |
| `src/Samples/` | End-to-end sample projects: component authoring (`NetProjectionSample`, `AuthoringDemo`), WinUI desktop app (`WinUIDesktopSample`), background task component (`BgTaskComponent`). |
-| `src/Tests/` | Test projects: unit tests (`UnitTest/`), functional/AOT tests (`FunctionalTests/`), source generator and analyzer tests (`SourceGenerator2Test/`), object lifetime tests (`ObjectLifetimeTests/`), authoring tests (`AuthoringTest/`), and the C++ test component (`TestComponentCSharp/`). |
+| `src/Tests/` | Test projects: unit tests (`UnitTest/`), functional/AOT tests (`FunctionalTests/`), source generator and analyzer tests (`SourceGenerator2Test/`), object lifetime tests (`ObjectLifetimeTests.Lifted/`), authoring tests (`AuthoringTest/`, `AuthoringWuxTest/`, `AuthoringConsumptionTest/`, `AuthoringWuxConsumptionTest/`, `AuthoringWinUITest/`), build determinism (`BuildDeterminismTest/`), diagnostics (`DiagnosticTests/`), runtime framework version probing (`RuntimeFrameworkVersion/`), out-of-process EXE harness (`OOPExe/`), host (`HostTest/`), and the C++ test component (`TestComponentCSharp/`). |
| `src/TestWinRT/` | Git submodule of [microsoft/TestWinRT](https://github.com/microsoft/TestWinRT/), providing general language projection test coverage. Produces `TestComponent` and `BenchmarkComponent` consumed by the unit test and benchmark projects. |
| `build/` | Azure DevOps pipeline definitions for official builds and testing. Uses Maestro (from the [Arcade Build System](https://github.com/dotnet/arcade)) to publish builds for dependent projects. |
| `eng/` | Engineering infrastructure: Maestro publishing helpers and shared build scripts. |
diff --git a/.github/skills/update-copilot-instructions/SKILL.md b/.github/skills/update-copilot-instructions/SKILL.md
index e8bbbc8765..a1ac8650df 100644
--- a/.github/skills/update-copilot-instructions/SKILL.md
+++ b/.github/skills/update-copilot-instructions/SKILL.md
@@ -19,7 +19,7 @@ Read `.github/copilot-instructions.md` in full. Take note of every factual claim
### Step 2: analyze each project in depth
-Launch parallel explore agents for each of the 8 CsWinRT 3.0 projects listed in the instructions. For each project, verify:
+Launch parallel explore agents for each of the 11 CsWinRT 3.0 projects listed in the instructions. For each project, verify:
1. **WinRT.Runtime (`src/WinRT.Runtime2/`)**
- Directory structure matches what's documented
@@ -30,46 +30,63 @@ Launch parallel explore agents for each of the 8 CsWinRT 3.0 projects listed in
2. **WinRT.SourceGenerator2 (`src/Authoring/WinRT.SourceGenerator2/`)**
- Source generators listed still exist and generate what's described
- - Diagnostic analyzer list is complete and IDs are correct (check `DiagnosticDescriptors.cs`)
+ - Diagnostic analyzer list is complete and IDs are correct (check `DiagnosticDescriptors.cs` and `AnalyzerReleases.Shipped.md`)
- Diagnostic ID range is accurate
- Project dependencies are current
+ - Assembly name is current (it is `WinRT.SourceGenerator`, **not** `WinRT.SourceGenerator2` — the project folder has `2` for repo history, but the produced .dll does not)
-3. **cswinrt.exe (`src/cswinrt/`)**
- - Key files listed still exist
- - Command-line options are current (check `settings.h`)
- - Namespace additions in `strings/additions/` are up to date
- - Generated code patterns are accurately described
+3. **Projection writer (`src/WinRT.Projection.Writer/`)**
+ - Directory structure and namespaces match (`Attributes/`, `Builders/`, `Errors/`, `Extensions/`, `Factories/`, `Generation/`, `Helpers/`, `Metadata/`, `Models/`, `References/`, `Resolvers/`, `Resources/`, `Writers/`)
+ - Public API surface (`ProjectionWriter.Run`, `ProjectionWriterOptions` shape) is accurate
+ - Error ID range (5xxx in `Errors/WellKnownProjectionWriterExceptions.cs`) is accurate
+ - Resources structure (`Additions/` per-namespace + `Base/` baseline) matches
-4. **Impl generator (`src/WinRT.Impl.Generator/`)**
+4. **Reference projection generator (`src/WinRT.Projection.Ref.Generator/`)**
+ - CLI parameters on `ReferenceProjectionGeneratorArgs` are current
+ - Error ID range (`CSWINRTPROJECTIONREFGENxxxx`) in `Errors/WellKnownReferenceProjectionGeneratorExceptions.cs` is accurate
+ - Project settings (Native AOT, dependencies) are current
+ - MSBuild integration via `nuget/Microsoft.Windows.CsWinRT.targets` (CsWinRTGenerateProjection target → `RunCsWinRTProjectionRefGenerator`) is wired
+
+5. **Impl generator (`src/WinRT.Impl.Generator/`)**
- Type forward routing logic is current
- Project settings and dependencies are current
- CLI parameters are current
-5. **Projection generator (`src/WinRT.Projection.Generator/`)**
+6. **Projection generator (`src/WinRT.Projection.Generator/`)**
- Three projection modes are accurately described
- Namespace filter logic is current
- - Project settings and dependencies are current
+ - Project settings and dependencies (project reference to `WinRT.Projection.Writer`) are current
+ - The pipeline is documented as in-process (the projection writer is invoked as a library)
+ - `ProjectionGeneratorArgs` no longer contains any leftover `CsWinRTExePath` field
-6. **Interop generator (`src/WinRT.Interop.Generator/`)**
+7. **Interop generator (`src/WinRT.Interop.Generator/`)**
- Generated content categories are current
- Directory structure and key types are accurate
- Project settings and dependencies are current
-7. **WinMD generator (`src/WinRT.WinMD.Generator/`)**
+8. **WinMD generator (`src/WinRT.WinMD.Generator/`)**
- CLI parameters on `WinMDGeneratorArgs` are current
- Error ID range (`CSWINRTWINMDGENxxxx`) in `Errors/WellKnownWinMDExceptions.cs` is accurate
- Project settings and dependencies are current
- MSBuild integration via `nuget/Microsoft.Windows.CsWinRT.Authoring.WinMD.targets` is wired (gated on `CsWinRTComponent`)
-8. **Generator tasks (`src/WinRT.Generator.Tasks/`)**
- - MSBuild task classes are accurately listed (including `RunCsWinRTWinMDGenerator`)
+9. **Generator tasks (`src/WinRT.Generator.Tasks/`)**
+ - MSBuild task classes are accurately listed (including `RunCsWinRTProjectionRefGenerator` and `RunCsWinRTWinMDGenerator`)
- Task-to-tool mappings are current
-
-9. **SDK projection builds (`src/WinRT.Sdk.Projection/`)**
- - Assembly name logic (base vs XAML) is current
- - Windows SDK package download and WinMD sourcing is accurate
- - Build parameters (`WindowsSdkBuild`, `WindowsSdkXaml`) are current
- - Project settings are current
+ - No leftover `CsWinRTExePath` parameter on `RunCsWinRTMergedProjectionGenerator`
+
+10. **SDK projection builds (`src/WinRT.Sdk.Projection/`)**
+ - Assembly name logic (base vs XAML) is current
+ - Windows SDK package download and WinMD sourcing is accurate
+ - Build parameters (`WindowsSdkBuild`, `WindowsSdkXaml`, `SdkPackageVersion`) are current
+ - Project settings are current
+
+11. **WinRT.Internal (`src/WinRT.Internal/`)**
+ - Hand-authored C# source files mirror the historical IDL interop interfaces (HWND struct, `[ProjectionInternal]` attribute, all 14 `I*Interop` interfaces with their original IIDs)
+ - Project TFM uses the CsWinRT 3.0 revision (`net10.0-windows10.0.X.1`) so the `cswinrt3` SDK projection reference assemblies are selected, and `WindowsSdkPackageVersion` is pinned to match
+ - CsWinRT integration is disabled on the project itself (`CsWinRTEnabled`, `CsWinRTGenerateProjection`, `CsWinRTGenerateInteropAssembly[2]` all `false`)
+ - `GenerateWindowsRuntimeInternalWinMD` target invokes `cswinrtwinmdgen.exe` directly via `` (not via the `UsingTask` mechanism) to avoid `MSB3027` file-lock contention in Visual Studio
+ - Output `.winmd` lands at `$(TargetDir)$(AssemblyName).winmd` (`WindowsRuntime.Internal.winmd`), and `src/Directory.Build.props` exposes it via `$(CsWinRTInteropMetadata)` for downstream consumers
### Step 3: verify the test projects
diff --git a/build/AzurePipelineTemplates/CsWinRT-Build-Steps.yml b/build/AzurePipelineTemplates/CsWinRT-Build-Steps.yml
index a7f21658b8..e426c86bdd 100644
--- a/build/AzurePipelineTemplates/CsWinRT-Build-Steps.yml
+++ b/build/AzurePipelineTemplates/CsWinRT-Build-Steps.yml
@@ -194,17 +194,6 @@ steps:
sevenZipCompression: 5
archiveFile: $(StagingFolder)\Windows\sources.zip
- # Stage CsWinRT
- - task: CopyFiles@2
- displayName: Stage CsWinRT
- condition: and(succeeded(), and(eq(variables['BuildPlatform'], 'x86'), eq(variables['BuildConfiguration'], 'release')))
- inputs:
- SourceFolder: $(Build.SourcesDirectory)\src\_build\$(BuildPlatform)\$(BuildConfiguration)\cswinrt\bin
- Contents: |
- cswinrt.exe
- cswinrt.pdb
- TargetFolder: $(StagingFolder)\native
-
# Stage WindowsRuntime.Internal.winmd
- task: CopyFiles@2
displayName: Stage WindowsRuntime.Internal.winmd
diff --git a/build/AzurePipelineTemplates/CsWinRT-BuildAndTest-Stage-OneBranch.yml b/build/AzurePipelineTemplates/CsWinRT-BuildAndTest-Stage-OneBranch.yml
index 12dcc49074..cac7e4ae89 100644
--- a/build/AzurePipelineTemplates/CsWinRT-BuildAndTest-Stage-OneBranch.yml
+++ b/build/AzurePipelineTemplates/CsWinRT-BuildAndTest-Stage-OneBranch.yml
@@ -64,7 +64,6 @@ jobs:
command: sign
signing_profile: external_distribution
files_to_sign: |
- native/cswinrt.exe;
net10.0/WinRT.SourceGenerator.dll;
net10.0/WinRT.Host.Shim.dll;
net10.0/WinRT.Runtime.dll;
diff --git a/build/AzurePipelineTemplates/CsWinRT-PublishToNuGet-Steps.yml b/build/AzurePipelineTemplates/CsWinRT-PublishToNuGet-Steps.yml
index 22fe1c4931..b9f73b43ae 100644
--- a/build/AzurePipelineTemplates/CsWinRT-PublishToNuGet-Steps.yml
+++ b/build/AzurePipelineTemplates/CsWinRT-PublishToNuGet-Steps.yml
@@ -95,7 +95,7 @@ steps:
command: pack
searchPatternPack: nuget/Microsoft.Windows.CsWinRT.nuspec
configurationToPack: Release
- buildProperties: cswinrt_nuget_version=$(NugetVersion);cswinrt_exe=$(Build.SourcesDirectory)\release_x86\native\cswinrt.exe;interop_winmd=$(Build.SourcesDirectory)\release_x86\native\WindowsRuntime.Internal.winmd;net10_runtime=$(Build.SourcesDirectory)\release_x86\net10.0\WinRT.Runtime.dll;net10_runtime_xml=$(Build.SourcesDirectory)\release_x86\net10.0\WinRT.Runtime.xml;source_generator=$(Build.SourcesDirectory)\release_x86\net10.0\WinRT.SourceGenerator.dll;winrt_shim=$(Build.SourcesDirectory)\release_x86\net10.0\WinRT.Host.Shim.dll;winrt_host_x86=$(Build.SourcesDirectory)\release_x86\native\WinRT.Host.dll;winrt_host_x64=$(Build.SourcesDirectory)\release_x64\native\WinRT.Host.dll;winrt_host_arm64=$(Build.SourcesDirectory)\release_arm64\native\WinRT.Host.dll;winrt_host_resource_x86=$(Build.SourcesDirectory)\release_x86\native\WinRT.Host.dll.mui;winrt_host_resource_x64=$(Build.SourcesDirectory)\release_x64\native\WinRT.Host.dll.mui;winrt_host_resource_arm64=$(Build.SourcesDirectory)\release_arm64\native\WinRT.Host.dll.mui;cswinrtinteropgen_x64=$(Build.SourcesDirectory)\release_x64\net10.0\native\cswinrtinteropgen.exe;cswinrtinteropgen_arm64=$(Build.SourcesDirectory)\release_arm64\net10.0\native\cswinrtinteropgen.exe;cswinrtimplgen_x64=$(Build.SourcesDirectory)\release_x64\net10.0\native\cswinrtimplgen.exe;cswinrtimplgen_arm64=$(Build.SourcesDirectory)\release_arm64\net10.0\native\cswinrtimplgen.exe;cswinrtprojectiongen_x64=$(Build.SourcesDirectory)\release_x64\net10.0\native\cswinrtprojectiongen.exe;cswinrtprojectiongen_arm64=$(Build.SourcesDirectory)\release_arm64\net10.0\native\cswinrtprojectiongen.exe;run_cswinrt_generator_task=$(Build.SourcesDirectory)\release_x86\netstandard2.0\WinRT.Generator.Tasks.dll;branch=$(Build.SourceBranchName);commit=$(Build.SourceVersion)
+ buildProperties: cswinrt_nuget_version=$(NugetVersion);interop_winmd=$(Build.SourcesDirectory)\release_x86\native\WindowsRuntime.Internal.winmd;net10_runtime=$(Build.SourcesDirectory)\release_x86\net10.0\WinRT.Runtime.dll;net10_runtime_xml=$(Build.SourcesDirectory)\release_x86\net10.0\WinRT.Runtime.xml;source_generator=$(Build.SourcesDirectory)\release_x86\net10.0\WinRT.SourceGenerator.dll;winrt_shim=$(Build.SourcesDirectory)\release_x86\net10.0\WinRT.Host.Shim.dll;winrt_host_x86=$(Build.SourcesDirectory)\release_x86\native\WinRT.Host.dll;winrt_host_x64=$(Build.SourcesDirectory)\release_x64\native\WinRT.Host.dll;winrt_host_arm64=$(Build.SourcesDirectory)\release_arm64\native\WinRT.Host.dll;winrt_host_resource_x86=$(Build.SourcesDirectory)\release_x86\native\WinRT.Host.dll.mui;winrt_host_resource_x64=$(Build.SourcesDirectory)\release_x64\native\WinRT.Host.dll.mui;winrt_host_resource_arm64=$(Build.SourcesDirectory)\release_arm64\native\WinRT.Host.dll.mui;cswinrtinteropgen_x64=$(Build.SourcesDirectory)\release_x64\net10.0\native\cswinrtinteropgen.exe;cswinrtinteropgen_arm64=$(Build.SourcesDirectory)\release_arm64\net10.0\native\cswinrtinteropgen.exe;cswinrtimplgen_x64=$(Build.SourcesDirectory)\release_x64\net10.0\native\cswinrtimplgen.exe;cswinrtimplgen_arm64=$(Build.SourcesDirectory)\release_arm64\net10.0\native\cswinrtimplgen.exe;cswinrtprojectiongen_x64=$(Build.SourcesDirectory)\release_x64\net10.0\native\cswinrtprojectiongen.exe;cswinrtprojectiongen_arm64=$(Build.SourcesDirectory)\release_arm64\net10.0\native\cswinrtprojectiongen.exe;run_cswinrt_generator_task=$(Build.SourcesDirectory)\release_x86\netstandard2.0\WinRT.Generator.Tasks.dll;branch=$(Build.SourceBranchName);commit=$(Build.SourceVersion)
packDestination: $(ob_outputDirectory)\packages
- ${{ if eq(parameters.IsGitHub, false) }}:
diff --git a/docs/diagnostics/cswinrt30001.md b/docs/diagnostics/cswinrt30001.md
index c9877706fe..ab79628ea5 100644
--- a/docs/diagnostics/cswinrt30001.md
+++ b/docs/diagnostics/cswinrt30001.md
@@ -1,6 +1,6 @@
# CsWinRT warning CSWINRT3001
-This type or method is a private implementation detail, and it's only meant to be consumed by generated projections (produced by 'cswinrt.exe') and by generated interop code (produced by 'cswinrtinteropgen.exe'). Private implementation detail types are not considered part of the versioned API surface, and they are ignored when determining the assembly version following semantic versioning. Types might be modified or removed across any version change for 'WinRT.Runtime.dll', and using them in user code is undefined behavior and not supported.
+This type or method is a private implementation detail, and it's only meant to be consumed by generated projections (produced by the CsWinRT projection writer at build time) and by generated interop code (produced by 'cswinrtinteropgen.exe'). Private implementation detail types are not considered part of the versioned API surface, and they are ignored when determining the assembly version following semantic versioning. Types might be modified or removed across any version change for 'WinRT.Runtime.dll', and using them in user code is undefined behavior and not supported.
For instance, the following sample generates CSWINRT3001:
@@ -22,7 +22,7 @@ Using any private implementation detail API is not supported, and should be cons
`CSWINRT30001` is emitted when user code tries to reference a type that is marked as a **private implementation detail** within `WinRT.Runtime.dll` or the generated `WinRT.Interop.dll`. These private implementation detail types exist solely to support the marshalling pipeline that CsWinRT and the .NET SDK generate at build time. They are not part of the public, versioned API surface, and consuming them from application code is unsupported.
-While all of these types are public (as they are used across assembglies), they are intentionally hidden from IntelliSense and decorated with `[Obsolete]` (with `CSWINRT3001` as the diagnostic id) to warn when they are referenced. Their names often include `Impl`, `Helpers`, or other internal wording, and their diagnostic message explicitly states that they are private implementation details. During a build, `cswinrt.exe` produces projections and `cswinrtinteropgen.exe` produces `WinRT.Interop.dll`. The generated code inside these tools uses private implementation detail types to perform marshalling work. See `docs/winrt-interop-dll-spec.md` for a description of the generated interop assembly. Because the tooling controls all references to these types, their shape can change whenever needed without breaking consumers. This flexibility is what allows performance and reliability improvements across releases.
+While all of these types are public (as they are used across assembglies), they are intentionally hidden from IntelliSense and decorated with `[Obsolete]` (with `CSWINRT3001` as the diagnostic id) to warn when they are referenced. Their names often include `Impl`, `Helpers`, or other internal wording, and their diagnostic message explicitly states that they are private implementation details. During a build, the CsWinRT projection writer produces the projection sources for component libraries and Windows SDK / WinUI projections, and `cswinrtinteropgen.exe` produces `WinRT.Interop.dll`. The generated code inside these tools uses private implementation detail types to perform marshalling work. See `docs/winrt-interop-dll-spec.md` for a description of the generated interop assembly. Because the tooling controls all references to these types, their shape can change whenever needed without breaking consumers. This flexibility is what allows performance and reliability improvements across releases.
## Recommended action
diff --git a/docs/interop.md b/docs/interop.md
index fd5b24d9c9..c358ef98b4 100644
--- a/docs/interop.md
+++ b/docs/interop.md
@@ -4,7 +4,7 @@
CsWinRT 3.0 provides a complete COM interop layer for Windows Runtime types on .NET 10+. All interop types are in the `WindowsRuntime.InteropServices` namespace (assembly: `WinRT.Runtime.dll`). Most marshalling is handled automatically by the generated projection and interop assemblies, but advanced scenarios may require direct use of the APIs below.
-> **Note:** CsWinRT exposes many types and methods marked `[Obsolete]` with diagnostic `CSWINRT3001`. These are **private implementation details** consumed only by generated code (`cswinrt.exe` and `cswinrtinteropgen.exe`). They are not part of the versioned API surface, may change without notice, and should not be used in application code. This guide covers only the supported public APIs.
+> **Note:** CsWinRT exposes many types and methods marked `[Obsolete]` with diagnostic `CSWINRT3001`. These are **private implementation details** consumed only by generated code (produced by the projection writer and `cswinrtinteropgen.exe`). They are not part of the versioned API surface, may change without notice, and should not be used in application code. This guide covers only the supported public APIs.
## Summary
diff --git a/docs/structure.md b/docs/structure.md
index 1a8c76b70c..e0895712cd 100644
--- a/docs/structure.md
+++ b/docs/structure.md
@@ -13,7 +13,7 @@ Contains files that assist with publishing to Maestro.
## [`nuget`](../nuget)
-Contains source files for producing the C#/WinRT NuGet package, which is regularly built, signed, and published to nuget.org by Microsoft. The package contains the **cswinrt.exe** projection compiler, the post-build tools (**cswinrtprojectiongen.exe**, **cswinrtimplgen.exe**, **cswinrtinteropgen.exe**, **cswinrtwinmdgen.exe**), the runtime assembly (`WinRT.Runtime.dll`), precompiled SDK projection assemblies, MSBuild `.props`/`.targets` files, and the Roslyn source generator.
+Contains source files for producing the C#/WinRT NuGet package, which is regularly built, signed, and published to nuget.org by Microsoft. The package contains the post-build tools (**cswinrtprojectionrefgen.exe**, **cswinrtprojectiongen.exe**, **cswinrtimplgen.exe**, **cswinrtinteropgen.exe**, **cswinrtwinmdgen.exe**), the runtime assembly (`WinRT.Runtime.dll`), precompiled SDK projection assemblies, MSBuild `.props`/`.targets` files, and the Roslyn source generator.
## [`src/Authoring`](../src/Authoring)
@@ -23,18 +23,6 @@ Contains projects for implementing authoring and hosting support, including the
Contains benchmarks written using BenchmarkDotNet to track the performance of scenarios in the generated projection. To run the benchmarks using the CsWinRT projection, run `benchmark.cmd`.
-## [`src/cswinrt`](../src/cswinrt)
-
-Contains the sources and `cswinrt.vcxproj` project file for building the C#/WinRT compiler, **cswinrt.exe**.
-
-The compiler uses the [WinMD NuGet package](http://aka.ms/winmd/nuget) for parsing [ECMA-335 metadata](http://www.ecma-international.org/publications/standards/Ecma-335.htm) files. The WinMD github repo includes a [winmd.natvis](https://github.com/microsoft/winmd/blob/master/vs/winmd.natvis) script for debugging metadata parsing. A symlink can be used to install the script:
- > for /f "tokens=2*" %i in ('reg query "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" /v Personal ^| findstr Personal') do @for /f "tokens=2" %k in ('"%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere" -latest ^| findstr catalog_productLineVersion') do @echo %j\Visual Studio %k\Visualizers| for /f "delims=" %l in ('more') do @md "%l" 2>nul & mklink "%l\winmd.natvis" "c:\git\winmd\vs\winmd.natvis"
-
-The C#/WinRT project also contains a cswinrt.natvis script for debugging the C# projection writing, which can also be installed with a symlink:
-> for /f "tokens=2*" %i in ('reg query "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" /v Personal ^| findstr Personal') do @for /f "tokens=2" %k in ('"%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere" -latest ^| findstr catalog_productLineVersion') do @echo %j\Visual Studio %k\Visualizers| for /f "delims=" %l in ('more') do @md "%l" 2>nul & mklink "%l\cswinrt.natvis" "c:\git\cswinrt\cswinrt\cswinrt.natvis"
-
-See also [Deploying .natvis files](https://docs.microsoft.com/en-us/visualstudio/debugger/create-custom-views-of-native-objects?view=vs-2015#BKMK_natvis_location).
-
## [`src/Perf`](../src/Perf)
Contains performance-related tools, including a benchmark baseline and the IID optimizer.
@@ -65,7 +53,7 @@ C#/WinRT makes use of the standalone [TestWinRT](https://github.com/microsoft/Te
## [`src/WinRT.Generator.Tasks`](../src/WinRT.Generator.Tasks)
-Contains MSBuild task wrappers that invoke the CsWinRT code generators during the build. These tasks orchestrate the post-build tools — the projection generator, the impl/forwarder generator, the interop generator, and the WinMD generator — and are called from the MSBuild targets in the `nuget/` directory.
+Contains MSBuild task wrappers that invoke the CsWinRT code generators during the build. These tasks orchestrate the post-build tools — the reference projection source generator, the projection generator, the impl/forwarder generator, the interop generator, and the WinMD generator — and are called from the MSBuild targets in the `nuget/` directory.
## [`src/WinRT.Impl.Generator`](../src/WinRT.Impl.Generator)
@@ -77,7 +65,15 @@ Contains the **interop assembly generator** (`cswinrtinteropgen.exe`). This tool
## [`src/WinRT.Projection.Generator`](../src/WinRT.Projection.Generator)
-Contains the **projection assembly generator** (`cswinrtprojectiongen.exe`). This tool runs at **app build time** and produces `WinRT.Projection.dll`, which contains the actual projection implementations for all WinRT types used by the application. The forwarder assemblies from component NuGet packages route their types into this assembly. For Windows SDK types, the CsWinRT NuGet package includes precompiled `WinRT.Sdk.Projection.dll` binaries, so this tool only needs to generate projections for third-party components.
+Contains the **projection assembly generator** (`cswinrtprojectiongen.exe`). This tool runs at **app build time** and produces `WinRT.Projection.dll`, which contains the actual projection implementations for all WinRT types used by the application. The forwarder assemblies from component NuGet packages route their types into this assembly. For Windows SDK types, the CsWinRT NuGet package includes precompiled `WinRT.Sdk.Projection.dll` binaries, so this tool only needs to generate projections for third-party components. The generator drives the [`WinRT.Projection.Writer`](../src/WinRT.Projection.Writer) library in-process to produce its C# sources, then compiles them with Roslyn.
+
+## [`src/WinRT.Projection.Ref.Generator`](../src/WinRT.Projection.Ref.Generator)
+
+Contains the **reference projection source generator** (`cswinrtprojectionrefgen.exe`). This Native AOT CLI tool runs at component-library build time, driving the projection writer in-process to produce the `.cs` files that `csc.exe` then compiles into the user library/component `.dll`. It is invoked from the `CsWinRTGenerateProjection` MSBuild target.
+
+## [`src/WinRT.Projection.Writer`](../src/WinRT.Projection.Writer)
+
+Contains the **projection writer**, a C# library that reads `.winmd` metadata and generates C# projection source code for Windows Runtime types. The writer ships as a library and is consumed by both `cswinrtprojectionrefgen.exe` (component-library build time) and `cswinrtprojectiongen.exe` (app publish time) via a single `ProjectionWriter.Run(ProjectionWriterOptions)` entry point.
## [`src/WinRT.WinMD.Generator`](../src/WinRT.WinMD.Generator)
diff --git a/docs/usage.md b/docs/usage.md
index 4f106bcfec..12dd217e9c 100644
--- a/docs/usage.md
+++ b/docs/usage.md
@@ -5,7 +5,7 @@ The [C#/WinRT NuGet package](https://www.nuget.org/packages/Microsoft.Windows.Cs
- [Generate and distribute a projection](#generate-and-distribute-a-projection)
- [Author and consume a C#/WinRT component](#author-and-consume-a-cwinrt-component) (coming soon for 3.0)
-For more information on using the NuGet package, refer to the [NuGet documentation](../nuget/readme.md). Command line options can be displayed by running `cswinrt -?`.
+For more information on using the NuGet package, refer to the [NuGet documentation](../nuget/readme.md). Command line options can be displayed by running `cswinrtprojectionrefgen -h`.
## Getting started with CsWinRT 3.0
@@ -56,13 +56,13 @@ Here is an example project file for a projection project that generates a refere
By default, the **Windows** and **Microsoft** namespaces are not projected. The `CsWinRTGenerateReferenceProjection` property indicates this library is a projection project and configures it to generate a reference projection. For a full list of C#/WinRT NuGet project properties, refer to the [NuGet documentation](../nuget/readme.md).
-In the example diagram below, the projection project invokes **cswinrt.exe** at build time, which processes `.winmd` files in the "Contoso" namespace to generate projection source files and compiles these into a reference projection assembly named `Contoso.projection.dll` under the `ref` subfolder along with a forwarder assembly with the same name. The reference and forwarder assembly is typically distributed along with the implementation assemblies (`Contoso.*.dll`) as a NuGet package.
+In the example diagram below, the projection project invokes **cswinrtprojectionrefgen.exe** at build time, which processes `.winmd` files in the "Contoso" namespace to generate projection source files and compiles these into a reference projection assembly named `Contoso.projection.dll` under the `ref` subfolder along with a forwarder assembly with the same name. The reference and forwarder assembly is typically distributed along with the implementation assemblies (`Contoso.*.dll`) as a NuGet package.
```mermaid
flowchart TD
subgraph build ["Generate reference projection from a component"]
direction LR
- WINMD["Contoso.*.winmd"] -->|cswinrt.exe| CS["Contoso.*.cs\n(projection sources)"]
+ WINMD["Contoso.*.winmd"] -->|cswinrtprojectionrefgen.exe| CS["Contoso.*.cs\n(projection sources)"]
CS -->|csc.exe| REF["ref/Contoso.projection.dll\n(Reference Assembly)"]
REF -->|cswinrtimplgen.exe| FWD["Contoso.projection.dll\n(Forwarder Assembly)"]
end
diff --git a/nuget/Microsoft.Windows.CsWinRT.Authoring.targets b/nuget/Microsoft.Windows.CsWinRT.Authoring.targets
index 0dd2544db8..d33ee6e931 100644
--- a/nuget/Microsoft.Windows.CsWinRT.Authoring.targets
+++ b/nuget/Microsoft.Windows.CsWinRT.Authoring.targets
@@ -30,7 +30,6 @@ Copyright (C) Microsoft Corporation. All rights reserved.
-
diff --git a/nuget/Microsoft.Windows.CsWinRT.CsWinRTGen.targets b/nuget/Microsoft.Windows.CsWinRT.CsWinRTGen.targets
index 5564cdb840..3f553abc2a 100644
--- a/nuget/Microsoft.Windows.CsWinRT.CsWinRTGen.targets
+++ b/nuget/Microsoft.Windows.CsWinRT.CsWinRTGen.targets
@@ -343,7 +343,6 @@ Copyright (C) Microsoft Corporation. All rights reserved.
WinMDPaths="@(_WinMDPathsList)"
TargetFramework="$(CsWinRTExeTFM)"
WindowsMetadata="$(CsWinRTWindowsMetadata)"
- CsWinRTExePath="$(CsWinRTExe)"
CsWinRTToolsDirectory="$(CsWinRTMergedProjectionEffectiveToolsDirectory)"
CsWinRTToolsArchitecture="$(CsWinRTToolsArchitecture)"
AdditionalArguments="@(CsWinRTGeneratorAdditionalArgument)"
@@ -393,7 +392,7 @@ Copyright (C) Microsoft Corporation. All rights reserved.
<_ComponentProjectionReferenceAssemblyPaths Include="@(ReferencePath)" Condition="!$([System.String]::new('%(Identity)').EndsWith('.winmd'))" />
<_ComponentProjectionReferenceAssemblyPaths Include="@(IntermediateAssembly)" Condition="'$(CsWinRTComponent)' == 'true'" />
-
+
<_ComponentWinMDPaths Include="@(_WinMDPathsList)" />
<_ComponentWinMDPaths Include="$([MSBuild]::NormalizePath('$(MSBuildProjectDirectory)', '$(IntermediateOutputPath)', '$(AssemblyName).winmd'))"
Condition="'$(CsWinRTComponent)' == 'true'" />
@@ -406,7 +405,6 @@ Copyright (C) Microsoft Corporation. All rights reserved.
WinMDPaths="@(_ComponentWinMDPaths)"
TargetFramework="$(CsWinRTExeTFM)"
WindowsMetadata="$(CsWinRTWindowsMetadata)"
- CsWinRTExePath="$(CsWinRTExe)"
AssemblyName="WinRT.Component"
CsWinRTToolsDirectory="$(CsWinRTMergedProjectionEffectiveToolsDirectory)"
CsWinRTToolsArchitecture="$(CsWinRTToolsArchitecture)"
@@ -482,7 +480,6 @@ Copyright (C) Microsoft Corporation. All rights reserved.
WinMDPaths="@(_SdkWinMDPathsList)"
TargetFramework="$(CsWinRTExeTFM)"
WindowsMetadata="$(CsWinRTWindowsMetadata)"
- CsWinRTExePath="$(CsWinRTExe)"
AssemblyName="WinRT.Sdk.Projection"
WindowsSdkOnly="true"
CsWinRTToolsDirectory="$(CsWinRTMergedProjectionEffectiveToolsDirectory)"
@@ -567,7 +564,6 @@ Copyright (C) Microsoft Corporation. All rights reserved.
WinMDPaths="@(_SdkXamlWinMDPathsList)"
TargetFramework="$(CsWinRTExeTFM)"
WindowsMetadata="$(CsWinRTWindowsMetadata)"
- CsWinRTExePath="$(CsWinRTExe)"
AssemblyName="WinRT.Sdk.Xaml.Projection"
WindowsSdkOnly="true"
WindowsUIXamlProjection="true"
diff --git a/nuget/Microsoft.Windows.CsWinRT.nuspec b/nuget/Microsoft.Windows.CsWinRT.nuspec
index 999baf730d..8d39e1a566 100644
--- a/nuget/Microsoft.Windows.CsWinRT.nuspec
+++ b/nuget/Microsoft.Windows.CsWinRT.nuspec
@@ -21,7 +21,6 @@
-
diff --git a/nuget/Microsoft.Windows.CsWinRT.props b/nuget/Microsoft.Windows.CsWinRT.props
index 9e60305734..a5a28256a2 100644
--- a/nuget/Microsoft.Windows.CsWinRT.props
+++ b/nuget/Microsoft.Windows.CsWinRT.props
@@ -7,7 +7,6 @@ Copyright (C) Microsoft Corporation. All rights reserved.
$([MSBuild]::NormalizeDirectory('$(MSBuildThisFileDirectory)', '..'))
- $(CsWinRTPath)tools\win-x86\cswinrt.exetrue
diff --git a/nuget/Microsoft.Windows.CsWinRT.targets b/nuget/Microsoft.Windows.CsWinRT.targets
index e199ab83ff..18151c0538 100644
--- a/nuget/Microsoft.Windows.CsWinRT.targets
+++ b/nuget/Microsoft.Windows.CsWinRT.targets
@@ -7,7 +7,6 @@ Copyright (C) Microsoft Corporation. All rights reserved.
normal
- -verbose$(ResolveAssemblyReferencesDependsOn);CsWinRTRemoveWindowsReferencetruefalse
@@ -210,11 +209,6 @@ Copyright (C) Microsoft Corporation. All rights reserved.
-
-
-
-
-
- "$(CsWinRTExe)" %40"$(CsWinRTResponseFile)"
- -input $(CsWinRTWindowsMetadata)
-
+ Condition="'$(CsWinRTGenerateProjection)' == 'true'">
-
@@ -261,39 +244,17 @@ Copyright (C) Microsoft Corporation. All rights reserved.
$([MSBuild]::NormalizePath('$(MSBuildThisFileDirectory)', '..\metadata\WindowsRuntime.Internal.winmd'))
-
--input $(CsWinRTInteropMetadata)
--include WindowsRuntime.Internal
-
-
- -public_exclusiveto
- -idic_exclusiveto
- -reference_projection
-
-
-$(CsWinRTCommandVerbosity)
--target $(CsWinRTExeTFM)
-$(CsWinRTWindowsMetadataInput)
--input @(CsWinRTInputs->'"%(FullPath)"', ' ')
--output "$(CsWinRTGeneratedFilesDir.TrimEnd('\'))"
-$(CsWinRTFilters)
-$(CsWinRTIncludeWinRTInterop)
-$(CsWinRTPublicExclusiveTo)
-$(CsWinRTDynamicallyInterfaceCastableExclusiveTo)
-$(CsWinRTReferenceProjection)
- falsetrue
- 0
@@ -301,13 +262,12 @@ $(CsWinRTReferenceProjection)
-
@@ -322,7 +282,7 @@ $(CsWinRTReferenceProjection)
<_CsWinRTRefHasWindows Include="@(_CsWinRTRefIncludes)" Condition="'%(Identity)' == 'Windows'" />
@@ -356,19 +316,7 @@ $(CsWinRTReferenceProjection)
ReferenceProjection="$(CsWinRTGenerateReferenceProjection)"
CsWinRTToolsDirectory="$(CsWinRTRefGenEffectiveToolsDirectory)"
CsWinRTToolsArchitecture="$(CsWinRTToolsArchitecture)"
- ContinueOnError="$(CsWinRTContinueOnError)">
-
-
-
-
-
-
-
-
-
-
-
-
+ ContinueOnError="$(CsWinRTContinueOnError)" />
diff --git a/nuget/readme.md b/nuget/readme.md
index 392c45f1af..fa9f165dad 100644
--- a/nuget/readme.md
+++ b/nuget/readme.md
@@ -39,7 +39,6 @@ C#/WinRT behavior can be customized with these project properties:
| CsWinRTExcludes | "Windows;Microsoft" | Semicolon-separated namespaces to exclude from projection output |
| CsWinRTFilters | "" | **Specifies the -includes and -excludes to include in projection output |
| CsWinRTInputs | *@(ReferencePath) | Specifies WinMD files (beyond the Windows SDK) to read metadata from |
-| CsWinRTParams | "" | ***Custom cswinrt.exe command-line parameters, replacing default settings below |
| CsWinRTWindowsMetadata | \ \| "local" \| "sdk" \| *$(WindowsSDKVersion) | Specifies the source for Windows metadata |
| CsWinRTGeneratedFilesDir | *"$(IntermediateOutputPath)\Generated Files" | Specifies the location for generated project source files |
| CsWinRTMessageImportance | low \| *normal \| high | Sets the [importance](https://docs.microsoft.com/en-us/visualstudio/msbuild/message-task?view=vs-2017) of C#/WinRT build messages (see below) |
@@ -50,13 +49,6 @@ C#/WinRT behavior can be customized with these project properties:
* -exclude $(CsWinRTExcludes)
* -include $(CsWinRTIncludes)
-***If CsWinRTParams is not defined, the following effective value is used:
-* -target $(TargetFramework)
-* -input $(CsWinRTWindowsMetadata)
-* -input @(CsWinRTInputs)
-* -output $(CsWinRTGeneratedFilesDir)
-* $(CsWinRTFilters)
-
## Runtime feature switches
CsWinRT provides runtime feature switches that allow opt-in/opt-out of specific functionality. When a feature is disabled, all code behind that switch is dead-code-eliminated by the trimmer, making features fully pay-for-play. See the [AOT and trimming documentation](../docs/aot-trimming.md) for more details.
@@ -94,7 +86,7 @@ The MSBuild verbosity level maps to MSBuild message importance as follows:
| m[inimal] | *high |
| n[ormal] | normal+ |
| d[etailed], diag[nostic] | low+ |
-*"high" also enables the cswinrt.exe -verbosity switch
+*"high" also enables the projection writer's verbose progress messages
For example, if the verbosity is set to minimal, then only messages with high importance are generated. However, if the verbosity is set to diagnostic, then all messages are generated.
diff --git a/src/Directory.Build.props b/src/Directory.Build.props
index d615e4804e..e05e1c2668 100644
--- a/src/Directory.Build.props
+++ b/src/Directory.Build.props
@@ -63,19 +63,6 @@
x86$([MSBuild]::NormalizeDirectory('$(MSBuildThisFileDirectory)_build', '$(BuildPlatform)', '$(Configuration)'))
-
- $([MSBuild]::NormalizeDirectory('$(BuildOutDir)', 'cswinrt', 'bin'))
- $([MSBuild]::NormalizeDirectory('$(MSBuildThisFileDirectory)_build', 'x86', '$(Configuration)', 'cswinrt', 'bin'))
- $(CsWinRTPath)cswinrt.exe
-
net10.0-windows10.0.26100.110.0.17763.0
-
+
+
+ WindowsRuntime.Internal
+ WindowsRuntime.Internal
+
$(VersionString)
diff --git a/src/WinRT.Projection.Writer/eng/README.md b/src/WinRT.Projection.Writer/eng/README.md
deleted file mode 100644
index 12e76d430b..0000000000
--- a/src/WinRT.Projection.Writer/eng/README.md
+++ /dev/null
@@ -1,68 +0,0 @@
-# validate-writer-output.ps1
-
-A regression harness that catches accidental output drift in
-`WinRT.Projection.Writer`. It runs the writer against a configured set of
-scenarios (each described by an `.rsp` response file, the same format
-`WinRT.Projection.Writer.TestRunner` accepts), captures a SHA256 manifest of
-every emitted `.cs` file, and compares the result against a previously
-captured baseline.
-
-## Usage
-
-```powershell
-# First run: capture the baseline manifests for every .rsp scenario
-.\validate-writer-output.ps1 -Mode capture
-
-# Subsequent runs: validate that the writer still produces byte-identical output
-.\validate-writer-output.ps1 -Mode validate
-
-# Convenience: capture if no baseline exists yet, otherwise overwrite on drift
-.\validate-writer-output.ps1 -Mode capture-and-validate
-```
-
-## Parameters
-
-| Parameter | Default | Purpose |
-|---|---|---|
-| `-Mode` | (required) | One of `capture`, `validate`, `capture-and-validate`. |
-| `-RepoRoot` | the repo root, derived from the script's location | Override if running the script from outside the standard repo layout. |
-| `-RspRoot` | `$RepoRoot\eng\rsp` | The directory containing the `.rsp` files. Each `.rsp` file becomes one scenario, named by its file stem. |
-| `-Scenarios` | every `*.rsp` under `-RspRoot` | Restrict the scenario set when validating only a subset. |
-| `-Configuration` | `Release` | The build configuration used to locate the TestRunner exe. |
-
-## Per-scenario manifest layout
-
-For every scenario, the script writes a `.sha256` file under
-`$PSScriptRoot\baselines\.sha256` containing one line per emitted
-`.cs` file:
-
-```
-
-```
-
-Drift is reported with file-by-file diffs (added / removed / changed).
-
-## Notes
-
-- The `.rsp` files are not committed alongside the script because they encode
- paths into local `.winmd` metadata sources that vary between machines. Each
- contributor sets up their own `.rsp` files for the scenarios they care
- about, then captures a baseline against the writer state they consider
- correct, and validates from there.
-- The harness validates byte-for-byte equality of the emitted `.cs` files
- against the captured baseline. If a refactor intentionally changes the
- emitted formatting (whitespace, ordering, etc.) the contributor is expected
- to recapture the baselines after manually reviewing that the change is
- benign.
-
-## Why no xunit / unit test project?
-
-The writer's correctness is verified end-to-end via this harness rather than
-through a parallel xunit test project, mirroring the convention used by
-`WinRT.Interop.Generator` (which also has no xunit tests of its own — its
-correctness is validated by integration-level tests in `src/Tests/`).
-End-to-end byte-identity testing across the eight projection scenarios catches
-real correctness regressions at a granularity that unit tests of helpers like
-`IndentedTextWriter` would miss (e.g. interactions between brace-prepend
-rules, namespace nesting, and the multi-line raw-string emission paths).
-
diff --git a/src/WinRT.Projection.Writer/eng/validate-writer-output.ps1 b/src/WinRT.Projection.Writer/eng/validate-writer-output.ps1
deleted file mode 100644
index 87f2efcfa5..0000000000
--- a/src/WinRT.Projection.Writer/eng/validate-writer-output.ps1
+++ /dev/null
@@ -1,150 +0,0 @@
-# Golden-output validation harness for WinRT.Projection.Writer.
-#
-# Modes:
-# .\validate-writer-output.ps1 -Mode capture # capture baseline manifests for the configured scenarios
-# .\validate-writer-output.ps1 -Mode validate # run every scenario, compare hashes, exit non-zero on drift
-# .\validate-writer-output.ps1 -Mode capture-and-validate # capture if missing; otherwise validate, overwrite on drift
-#
-# Per-scenario manifests are stored under: $PSScriptRoot\baselines\.sha256
-# Each scenario is described by an .rsp response file (the same format the TestRunner accepts);
-# the .rsp files live under $RspRoot and select the input metadata + output directory for one
-# regen scenario. The harness loads all .rsp files under $RspRoot whose name (without extension)
-# matches one of the configured -Scenarios.
-#
-# This script is environment-portable: -RepoRoot defaults to the repo root inferred from the
-# script's own location, and -RspRoot defaults to a sibling 'rsp' directory under -RepoRoot.
-# Override either one when calling the script if your local layout differs.
-
-[CmdletBinding()]
-param(
- [Parameter(Mandatory=$true)]
- [ValidateSet('capture','validate','capture-and-validate')]
- [string]$Mode,
- [string]$RepoRoot = (Resolve-Path (Join-Path $PSScriptRoot '..\..\..')).Path,
- [string]$RspRoot = (Join-Path (Resolve-Path (Join-Path $PSScriptRoot '..\..\..')).Path 'eng\rsp'),
- [string[]]$Scenarios,
- [string]$Configuration = 'Release'
-)
-
-$ErrorActionPreference = 'Stop'
-$baselineDir = Join-Path $PSScriptRoot 'baselines'
-if (-not (Test-Path $baselineDir)) { New-Item -ItemType Directory -Path $baselineDir | Out-Null }
-
-# Auto-discover scenarios from the .rsp directory if none were explicitly listed.
-if (-not $Scenarios) {
- if (-not (Test-Path $RspRoot)) {
- throw "RspRoot '$RspRoot' does not exist. Pass -RspRoot pointing at a folder of .rsp files, or -Scenarios ."
- }
- $Scenarios = Get-ChildItem $RspRoot -Filter '*.rsp' | Sort-Object Name | ForEach-Object { [System.IO.Path]::GetFileNameWithoutExtension($_.Name) }
- if (-not $Scenarios) {
- throw "No .rsp files found under '$RspRoot'."
- }
-}
-
-# Locate the TestRunner exe.
-$runner = "$RepoRoot\src\WinRT.Projection.Writer.TestRunner\bin\$Configuration\net10.0\WinRT.Projection.Writer.TestRunner.exe"
-if (-not (Test-Path $runner)) {
- Write-Host 'TestRunner exe not found; building...' -ForegroundColor Yellow
- $proj = "$RepoRoot\src\WinRT.Projection.Writer.TestRunner\WinRT.Projection.Writer.TestRunner.csproj"
- if (-not (Test-Path $proj)) { throw "TestRunner csproj not found at '$proj'." }
- $buildLog = & dotnet build $proj -c $Configuration --nologo 2>&1
- if ($LASTEXITCODE -ne 0) {
- Write-Host 'TestRunner build failed:' -ForegroundColor Red
- $buildLog | Select-Object -Last 25 | ForEach-Object { Write-Host $_ }
- throw 'TestRunner build failed.'
- }
- if (-not (Test-Path $runner)) { throw "TestRunner exe still not found at '$runner' after build." }
-}
-
-Write-Host "TestRunner: $runner" -ForegroundColor Cyan
-
-function Get-ManifestForScenario {
- param([string]$ScenarioName)
- $rsp = Join-Path $RspRoot "$ScenarioName.rsp"
- if (-not (Test-Path $rsp)) { return $null }
- $outDir = (((Get-Content $rsp -Raw) -split "`r?`n") | Where-Object { $_ -match '^--output-directory' } | Select-Object -First 1) -replace '^--output-directory ', ''
- $outDir = $outDir.Trim()
- if (-not (Test-Path $outDir)) { return $null }
- $sb = [System.Text.StringBuilder]::new()
- Get-ChildItem "$outDir\*.cs" | Sort-Object Name | ForEach-Object {
- $hash = (Get-FileHash $_.FullName -Algorithm SHA256).Hash
- [void]$sb.Append($hash).Append(' ').AppendLine($_.Name)
- }
- return $sb.ToString()
-}
-
-function Run-Scenario {
- param([string]$ScenarioName)
- $rsp = Join-Path $RspRoot "$ScenarioName.rsp"
- if (-not (Test-Path $rsp)) { Write-Host "SKIP: $ScenarioName ($rsp not found)" -ForegroundColor Yellow; return $false }
- $output = & $runner 'rsp' $rsp 2>&1
- if ($LASTEXITCODE -ne 0) {
- Write-Host "$ScenarioName : EXEC FAILED (exit=$LASTEXITCODE)" -ForegroundColor Red
- $output | Select-Object -Last 5 | ForEach-Object { Write-Host " $_" }
- return $false
- }
- return $true
-}
-
-$anyFailure = $false
-
-foreach ($scenario in $Scenarios) {
- $rsp = Join-Path $RspRoot "$scenario.rsp"
- if (-not (Test-Path $rsp)) { Write-Host "SKIP: $scenario (rsp missing)" -ForegroundColor Yellow; continue }
-
- $baselinePath = Join-Path $baselineDir "$scenario.sha256"
-
- if ($Mode -eq 'capture') {
- if (-not (Run-Scenario $scenario)) { $anyFailure = $true; continue }
- $manifest = Get-ManifestForScenario $scenario
- if ($manifest -eq $null) { Write-Host "$scenario : no output dir after run" -ForegroundColor Red; $anyFailure = $true; continue }
- Set-Content -Path $baselinePath -Value $manifest -NoNewline -Encoding utf8NoBOM
- $count = ($manifest.TrimEnd("`r`n").Split("`n") | Measure-Object).Count
- Write-Host ("{0,-40} CAPTURED files={1}" -f $scenario, $count) -ForegroundColor Green
- }
- elseif ($Mode -eq 'validate') {
- if (-not (Test-Path $baselinePath)) { Write-Host "$scenario : NO BASELINE (run -Mode capture first)" -ForegroundColor Red; $anyFailure = $true; continue }
- if (-not (Run-Scenario $scenario)) { $anyFailure = $true; continue }
- $current = Get-ManifestForScenario $scenario
- $baseline = Get-Content -Path $baselinePath -Raw
- if ($current -eq $baseline) {
- $count = ($current.TrimEnd("`r`n").Split("`n") | Measure-Object).Count
- Write-Host ("{0,-40} OK files={1}" -f $scenario, $count) -ForegroundColor Green
- } else {
- Write-Host ("{0,-40} DRIFT" -f $scenario) -ForegroundColor Red
- $baseLines = $baseline.Split("`n") | Where-Object { $_ }
- $curLines = $current.Split("`n") | Where-Object { $_ }
- $bMap = @{}; $cMap = @{}
- foreach ($l in $baseLines) { $i = $l.IndexOf(' '); $bMap[$l.Substring($i+1).Trim()] = $l.Substring(0,$i) }
- foreach ($l in $curLines) { $i = $l.IndexOf(' '); $cMap[$l.Substring($i+1).Trim()] = $l.Substring(0,$i) }
- $allFiles = ($bMap.Keys + $cMap.Keys) | Sort-Object -Unique
- $shown = 0
- foreach ($f in $allFiles) {
- if ($shown -ge 25) { Write-Host " ... (more drifted files omitted)" -ForegroundColor DarkGray; break }
- $bh = $bMap[$f]; $ch = $cMap[$f]
- if (-not $bh) { Write-Host " + $f (added)" -ForegroundColor Green; $shown++ }
- elseif (-not $ch) { Write-Host " - $f (removed)" -ForegroundColor Red; $shown++ }
- elseif ($bh -ne $ch) { Write-Host " ~ $f (changed)" -ForegroundColor Yellow; $shown++ }
- }
- $anyFailure = $true
- }
- }
- elseif ($Mode -eq 'capture-and-validate') {
- if (-not (Run-Scenario $scenario)) { $anyFailure = $true; continue }
- $manifest = Get-ManifestForScenario $scenario
- if (-not (Test-Path $baselinePath)) {
- Set-Content -Path $baselinePath -Value $manifest -NoNewline -Encoding utf8NoBOM
- Write-Host ("{0,-40} CAPTURED (no prior baseline)" -f $scenario) -ForegroundColor Green
- } else {
- $baseline = Get-Content -Path $baselinePath -Raw
- if ($manifest -eq $baseline) {
- Write-Host ("{0,-40} OK" -f $scenario) -ForegroundColor Green
- } else {
- Set-Content -Path $baselinePath -Value $manifest -NoNewline -Encoding utf8NoBOM
- Write-Host ("{0,-40} UPDATED (drift detected, baseline overwritten)" -f $scenario) -ForegroundColor Yellow
- }
- }
- }
-}
-
-if ($anyFailure) { exit 1 } else { exit 0 }
diff --git a/src/WinRT.Runtime2/Properties/WindowsRuntimeConstants.cs b/src/WinRT.Runtime2/Properties/WindowsRuntimeConstants.cs
index e871e10332..c6b39f72c7 100644
--- a/src/WinRT.Runtime2/Properties/WindowsRuntimeConstants.cs
+++ b/src/WinRT.Runtime2/Properties/WindowsRuntimeConstants.cs
@@ -12,7 +12,7 @@ internal static class WindowsRuntimeConstants
/// A message for private implementation detail types.
///
public const string PrivateImplementationDetailObsoleteMessage =
- "This type or method is a private implementation detail, and it's only meant to be consumed by generated projections (produced by 'cswinrt.exe') " +
+ "This type or method is a private implementation detail, and it's only meant to be consumed by generated projections (produced by 'cswinrtprojectiongen.exe') " +
"and by generated interop code (produced by 'cswinrtinteropgen.exe'). Private implementation detail types are not considered part of the versioned " +
"API surface, and they are ignored when determining the assembly version following semantic versioning. Types might be modified or removed " +
"across any version change for 'WinRT.Runtime.dll', and using them in user code is undefined behavior and not supported.";
diff --git a/src/WinRT.Sdk.Projection/WinRT.Sdk.Projection.csproj b/src/WinRT.Sdk.Projection/WinRT.Sdk.Projection.csproj
index aee23e661c..6332d84096 100644
--- a/src/WinRT.Sdk.Projection/WinRT.Sdk.Projection.csproj
+++ b/src/WinRT.Sdk.Projection/WinRT.Sdk.Projection.csproj
@@ -114,7 +114,6 @@
WinMDPaths="@(_SdkWinMDPaths)"
TargetFramework="net10.0"
WindowsMetadata="$(_WinMDFolder)"
- CsWinRTExePath="$(CsWinRTExe)"
AssemblyName="$(AssemblyName)"
WindowsSdkOnly="true"
WindowsUIXamlProjection="$(WindowsSdkXaml)"
diff --git a/src/build.cmd b/src/build.cmd
index e37bb39a60..d94c32c817 100644
--- a/src/build.cmd
+++ b/src/build.cmd
@@ -250,7 +250,6 @@ if "%cswinrt_label%"=="functionaltest" exit /b 0
:package
rem We set the properties of the CsWinRT.nuspec here, and pass them as the -Properties option when we call `nuget pack`
set cswinrt_bin_dir=%this_dir%_build\%cswinrt_platform%\%cswinrt_configuration%\cswinrt\bin\
-set cswinrt_exe=%cswinrt_bin_dir%cswinrt.exe
set interop_winmd=%this_dir%WinRT.Internal\bin\%cswinrt_configuration%\net10.0-windows10.0.26100.1\WindowsRuntime.Internal.winmd
set net10_runtime=%this_dir%WinRT.Runtime2\bin\%cswinrt_configuration%\net10.0\WinRT.Runtime.dll
set net10_runtime_xml=%this_dir%WinRT.Runtime2\bin\%cswinrt_configuration%\net10.0\WinRT.Runtime.xml
@@ -267,7 +266,7 @@ set run_cswinrt_generator_task=%this_dir%WinRT.Generator.Tasks\bin\%cswinrt_conf
rem Now call pack
echo Creating nuget package
-call :exec %nuget_dir%\nuget pack %this_dir%..\nuget\Microsoft.Windows.CsWinRT.nuspec -Properties cswinrt_exe=%cswinrt_exe%;interop_winmd=%interop_winmd%;net10_runtime=%net10_runtime%;net10_runtime_xml=%net10_runtime_xml%;source_generator=%source_generator%;cswinrt_nuget_version=%cswinrt_version_string%;winrt_host_x86=%winrt_host_x86%;winrt_host_x64=%winrt_host_x64%;winrt_host_arm=%winrt_host_arm%;winrt_host_arm64=%winrt_host_arm64%;winrt_host_resource_x86=%winrt_host_resource_x86%;winrt_host_resource_x64=%winrt_host_resource_x64%;winrt_host_resource_arm=%winrt_host_resource_arm%;winrt_host_resource_arm64=%winrt_host_resource_arm64%;winrt_shim=%winrt_shim%;cswinrtinteropgen_x64=%cswinrtinteropgen_x64%;cswinrtinteropgen_arm64=%cswinrtinteropgen_arm64%;cswinrtimplgen_x64=%cswinrtimplgen_x64%;cswinrtimplgen_arm64=%cswinrtimplgen_arm64%;cswinrtprojectiongen_x64=%cswinrtprojectiongen_x64%;cswinrtprojectiongen_arm64=%cswinrtprojectiongen_arm64%;cswinrtprojectionrefgen_x64=%cswinrtprojectionrefgen_x64%;cswinrtprojectionrefgen_arm64=%cswinrtprojectionrefgen_arm64%;run_cswinrt_generator_task=%run_cswinrt_generator_task%; -OutputDirectory %cswinrt_bin_dir% -NonInteractive -Verbosity Detailed -NoPackageAnalysis
+call :exec %nuget_dir%\nuget pack %this_dir%..\nuget\Microsoft.Windows.CsWinRT.nuspec -Properties interop_winmd=%interop_winmd%;net10_runtime=%net10_runtime%;net10_runtime_xml=%net10_runtime_xml%;source_generator=%source_generator%;cswinrt_nuget_version=%cswinrt_version_string%;winrt_host_x86=%winrt_host_x86%;winrt_host_x64=%winrt_host_x64%;winrt_host_arm=%winrt_host_arm%;winrt_host_arm64=%winrt_host_arm64%;winrt_host_resource_x86=%winrt_host_resource_x86%;winrt_host_resource_x64=%winrt_host_resource_x64%;winrt_host_resource_arm=%winrt_host_resource_arm%;winrt_host_resource_arm64=%winrt_host_resource_arm64%;winrt_shim=%winrt_shim%;cswinrtinteropgen_x64=%cswinrtinteropgen_x64%;cswinrtinteropgen_arm64=%cswinrtinteropgen_arm64%;cswinrtimplgen_x64=%cswinrtimplgen_x64%;cswinrtimplgen_arm64=%cswinrtimplgen_arm64%;cswinrtprojectiongen_x64=%cswinrtprojectiongen_x64%;cswinrtprojectiongen_arm64=%cswinrtprojectiongen_arm64%;cswinrtprojectionrefgen_x64=%cswinrtprojectionrefgen_x64%;cswinrtprojectionrefgen_arm64=%cswinrtprojectionrefgen_arm64%;run_cswinrt_generator_task=%run_cswinrt_generator_task%; -OutputDirectory %cswinrt_bin_dir% -NonInteractive -Verbosity Detailed -NoPackageAnalysis
goto :eof
:exec
diff --git a/src/cswinrt.slnx b/src/cswinrt.slnx
index 721a971c15..e62de46e37 100644
--- a/src/cswinrt.slnx
+++ b/src/cswinrt.slnx
@@ -19,7 +19,6 @@
-
@@ -158,6 +157,7 @@
+
@@ -260,7 +260,6 @@
-
@@ -274,7 +273,6 @@
-
@@ -418,11 +416,6 @@
-
-
-
-
-
diff --git a/src/cswinrt/Directory.Build.props b/src/cswinrt/Directory.Build.props
deleted file mode 100644
index a073339701..0000000000
--- a/src/cswinrt/Directory.Build.props
+++ /dev/null
@@ -1,11 +0,0 @@
-
-
-
-
-
-
- %(AdditionalOptions) /D UAC_VERSION=99
-
-
-
-
diff --git a/src/cswinrt/Directory.Build.targets b/src/cswinrt/Directory.Build.targets
deleted file mode 100644
index 5a487cd3f9..0000000000
--- a/src/cswinrt/Directory.Build.targets
+++ /dev/null
@@ -1,21 +0,0 @@
-
-
-
- $(MidlRTCopyWinMDToOutputDirectoryDependsOn);CopyWinRTInteropWinMD
-
-
-
-
-
-
-
-
-
-
-
diff --git a/src/cswinrt/PreviousPlatforms.linq b/src/cswinrt/PreviousPlatforms.linq
deleted file mode 100644
index 5b00c8aed3..0000000000
--- a/src/cswinrt/PreviousPlatforms.linq
+++ /dev/null
@@ -1,38 +0,0 @@
-
-
-// This script can be run periodically from within LINQPad (https://www.linqpad.net)
-// to generate aggregate data for get_contract_platform in helpers.h
-
-var doc = XDocument.Load(@"C:\Program Files (x86)\Windows Kits\10\Platforms\UAP\10.0.26100.0\PreviousPlatforms.xml");
-
-XNamespace pp = "http://microsoft.com/schemas/Windows/SDK/PreviousPlatforms";
-
-var contracts =
- from platform in doc.Elements().Elements()
- let PlatformName = platform.Attribute("friendlyName").Value
- let PlatformVersion = platform.Attribute("version").Value
- from contract in platform.Elements(pp + "ContainedApiContracts").Elements()
- let ContractName = contract.Attribute("name").Value
- let ContractVersion = contract.Attribute("version").Value
- let ContractNumber = int.Parse(ContractVersion.Replace(".0.0.0",""))
- orderby ContractName, ContractNumber, PlatformVersion
- group new{ContractNumber, PlatformVersion} by ContractName;
-
-foreach(var contract in contracts)
-{
- String.Format(
-@" {{ ""{0}"",
- {{", contract.Key).Dump();
- int ContractNumber = 0;
- foreach(var mapping in contract)
- {
- if(mapping.ContractNumber == ContractNumber) continue;
- ContractNumber= mapping.ContractNumber;
- String.Format(
-@" {{ {0}, ""{1}"" }},", mapping.ContractNumber, mapping.PlatformVersion).Dump();
- }
-
-@" }
- },".Dump();
-}
-
diff --git a/src/cswinrt/WindowsRuntime.Internal.idl b/src/cswinrt/WindowsRuntime.Internal.idl
deleted file mode 100644
index 7c134f3316..0000000000
--- a/src/cswinrt/WindowsRuntime.Internal.idl
+++ /dev/null
@@ -1,173 +0,0 @@
-// Modern IDL 3.0: https://docs.microsoft.com/en-us/uwp/midl-3/intro
-
-// Note: the projection generated for this metadata should be internal, and only
-// accessed indirectly with the user-friendly wrappers in ComInteropExtensions.cs.
-namespace WindowsRuntime.Internal
-{
- // C#/WinRT provides support for generating internal interface projections
- [attributeusage(target_interface)]
- [attributename("ProjectionInternal")]
- attribute ProjectionInternalAttribute
- {
- }
-
- // C#/WinRT provides a custom mapping of WindowsRuntime.Internal.HWND to System.IntPtr
- struct HWND
- {
- Int32 unused;
- };
-
- // accountssettingspaneinterop.idl (see: https://learn.microsoft.com/windows/win32/api/accountssettingspaneinterop/)
- [uuid(D3EE12AD-3865-4362-9746-B75A682DF0E6), ProjectionInternal]
- interface IAccountsSettingsPaneInterop
- {
- Windows.UI.ApplicationSettings.AccountsSettingsPane GetForWindow(
- HWND appWindow,
- ref const GUID riid); // __uuidof(AccountSettingsPanel)
-
- Windows.Foundation.IAsyncAction ShowManageAccountsForWindowAsync(
- HWND appWindow,
- ref const GUID riid); // __uuidof(IAsyncAction)
-
- Windows.Foundation.IAsyncAction ShowAddAccountForWindowAsync(
- HWND appWindow,
- ref const GUID riid); // __uuidof(IAsyncAction)
- }
-
- // dragdropinterop.idl (see: https://learn.microsoft.com/windows/win32/api/dragdropinterop/)
- [uuid(5AD8CBA7-4C01-4DAC-9074-827894292D63), ProjectionInternal]
- interface IDragDropManagerInterop
- {
- Windows.ApplicationModel.DataTransfer.DragDrop.Core.CoreDragDropManager GetForWindow(
- HWND hwnd,
- ref const GUID riid); // __uuidof(CoreDragDropManager)
- }
-
- // inputpaneinterop.idl (see: https://learn.microsoft.com/windows/win32/api/inputpaneinterop/)
- [uuid(75CF2C57-9195-4931-8332-F0B409E916AF), ProjectionInternal]
- interface IInputPaneInterop
- {
- Windows.UI.ViewManagement.InputPane GetForWindow(
- HWND appWindow,
- ref const GUID riid); // __uuidof(InputPane)
- }
-
- // PlayToManagerInterop.idl (see: https://learn.microsoft.com/windows/win32/api/playtomanagerinterop/)
- [uuid(24394699-1F2C-4EB3-8CD7-0EC1DA42A540), ProjectionInternal]
- interface IPlayToManagerInterop
- {
- Windows.Media.PlayTo.PlayToManager GetForWindow(
- HWND appWindow,
- ref const GUID riid); // __uuidof(PlayToManager)
-
- void ShowPlayToUIForWindow(
- HWND appWindow);
- }
-
- // PrintManagerInterop.idl (see: https://learn.microsoft.com/windows/win32/api/printmanagerinterop/)
- [uuid(c5435a42-8d43-4e7b-a68a-ef311e392087), ProjectionInternal]
- interface IPrintManagerInterop
- {
- Windows.Graphics.Printing.PrintManager GetForWindow(
- HWND appWindow,
- ref const GUID riid); // __uuidof(PrintManager)
-
- Windows.Foundation.IAsyncOperation ShowPrintUIForWindowAsync(
- HWND appWindow,
- ref const GUID riid); // __uuidof(IAsyncOperation)
- }
-
- // RadialControllerInterop.idl (see: https://learn.microsoft.com/windows/win32/api/radialcontrollerinterop/)
- [uuid(1B0535C9-57AD-45C1-9D79-AD5C34360513), ProjectionInternal]
- interface IRadialControllerInterop
- {
- Windows.UI.Input.RadialController CreateForWindow(
- HWND hwnd,
- ref const GUID riid); // __uuidof(RadialController)
- }
-
- [uuid(787cdaac-3186-476d-87e4-b9374a7b9970), ProjectionInternal]
- interface IRadialControllerConfigurationInterop
- {
- Windows.UI.Input.RadialControllerConfiguration GetForWindow(
- HWND hwnd,
- ref const GUID riid); // __uuidof(RadialControllerConfiguration)
- }
-
- [uuid(3D577EFF-4CEE-11E6-B535-001BDC06AB3B), ProjectionInternal]
- interface IRadialControllerIndependentInputSourceInterop
- {
- Windows.UI.Input.Core.RadialControllerIndependentInputSource CreateForWindow(
- HWND hwnd,
- ref const GUID riid); // __uuidof(RadialControllerIndependentInputSource)
- }
-
- // SpatialInteractionManagerInterop.idl (see: https://learn.microsoft.com/windows/win32/api/spatialinteractionmanagerinterop/)
- // This interop interface is duplicated by IHolographicSpaceInterop, which has the same IID
- [uuid(5C4EE536-6A98-4B86-A170-587013D6FD4B), ProjectionInternal]
- interface ISpatialInteractionManagerInterop
- {
- Windows.UI.Input.Spatial.SpatialInteractionManager GetForWindow(
- HWND window,
- ref const GUID riid); // __uuidof(SpatialInteractionManager)
- }
-
- // SystemMediaTransportControlsInterop.idl (see: https://learn.microsoft.com/windows/win32/api/systemmediatransportcontrolsinterop/)
- [uuid(ddb0472d-c911-4a1f-86d9-dc3d71a95f5a), ProjectionInternal]
- interface ISystemMediaTransportControlsInterop
- {
- Windows.Media.SystemMediaTransportControls GetForWindow(
- HWND appWindow,
- ref const GUID riid); // __uuidof(SystemMediaTransportControls)
- }
-
- // UIViewSettingsInterop.idl (see: https://learn.microsoft.com/windows/win32/api/uiviewsettingsinterop/)
- [uuid(3694dbf9-8f68-44be-8ff5-195c98ede8a6), ProjectionInternal]
- interface IUIViewSettingsInterop
- {
- Windows.UI.ViewManagement.UIViewSettings GetForWindow(
- HWND hwnd,
- ref const GUID riid); // __uuidof(UIViewSettings)
- }
-
- // UserConsentVerifierInterop.idl (see: https://learn.microsoft.com/windows/win32/api/userconsentverifierinterop/)
- [uuid(39E050C3-4E74-441A-8DC0-B81104DF949C), ProjectionInternal]
- interface IUserConsentVerifierInterop
- {
- Windows.Foundation.IAsyncOperation RequestVerificationForWindowAsync(
- HWND appWindow,
- String message,
- ref const GUID riid); // __uuidof(IAsyncOperation)
- }
-
- // WebAuthenticationCoreManagerInterop.idl (see: https://learn.microsoft.com/windows/win32/api/webauthenticationcoremanagerinterop/)
- [uuid(F4B8E804-811E-4436-B69C-44CB67B72084), ProjectionInternal]
- interface IWebAuthenticationCoreManagerInterop
- {
- Windows.Foundation.IAsyncOperation RequestTokenForWindowAsync(
- HWND appWindow,
- Windows.Security.Authentication.Web.Core.WebTokenRequest request,
- ref const GUID riid); // __uuidof(IAsyncOperation)
-
- Windows.Foundation.IAsyncOperation RequestTokenWithWebAccountForWindowAsync(
- HWND appWindow,
- Windows.Security.Authentication.Web.Core.WebTokenRequest request,
- Windows.Security.Credentials.WebAccount webAccount,
- ref const GUID riid); // __uuidof(IAsyncOperation)
- }
-
- // WindowsGraphicsDisplayInterop.idl (see: https://learn.microsoft.com/windows/win32/api/windows.graphics.display.interop/)
-#if UAC_VERSION > 14
- [uuid(7449121C-382B-4705-8DA7-A795BA482013), ProjectionInternal]
- interface IDisplayInformationStaticsInterop
- {
- Windows.Graphics.Display.DisplayInformation GetForWindow(
- HWND window,
- ref const GUID riid); // __uuidof(DisplayInformation)
-
- Windows.Graphics.Display.DisplayInformation GetForMonitor(
- HWND monitor,
- ref const GUID riid); // __uuidof(DisplayInformation)
- }
-#endif
-}
\ No newline at end of file
diff --git a/src/cswinrt/cmd_reader.h b/src/cswinrt/cmd_reader.h
deleted file mode 100644
index edc406c9a5..0000000000
--- a/src/cswinrt/cmd_reader.h
+++ /dev/null
@@ -1,686 +0,0 @@
-#pragma once
-
-#include
-#include
-#include
-#include
-#include
-#include
-#include