Skip to content

WAP project remove the WinRT COM Server's winmd file incorrectly #6352

@zhuxb711

Description

@zhuxb711

Describe the bug

Related to #6351

WAP output directory structure

WAP_Output_Directory
├── OtherProject // ref WinRTCOMServer.winmd through <CsWinRTInputs />
│   ├── ......
│   └── WinRTCOMServer.winmd
├── WinRTCOMServer
│   ├── ......
│   ├── WinRTCOMServer.dll
│   └── WinRTCOMServer.exe // No WinRTCOMServer.winmd
└── WinRTCOMServer.winmd // Placed here incorrectly

In WAP_Output_Directory\\WinRTCOMServer\\, there is no WinRTCOMServer.winmd placed beside WinRTCOMServer.exe. This behavior is because although we declare the WinRTCOMServer as OutOfProcessServer but WAP project will always consider it as InProcessServer incorrectly which already described in #6351 .

For in-process server case, the server implementation should be placed next to the client as it will be loaded into the client process, however, it's not the case for out-of-process. But the toolchain assumes we are using an in-process server always and does this unnecessary thing.

Workaround:
Add include the .winmd in the WinRTCOMServer by yourself.

    <None Include=".\bin\$(Platform)\$(Configuration)\$(TargetFramework)\$(RuntimeIdentifier)\WinRTCOMServer.winmd">
      <Visible>false</Visible>
      <Link>%(Filename).winmd</Link>
      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
    </None>

Steps to reproduce the bug

No need, please check the steps in #6351

Expected behavior

WAP_Output_Directory
├── OtherProject
│   ├── ......
│   └── WinRTCOMServer.winmd
└── WinRTCOMServer
    ├── ......
    ├── WinRTCOMServer.dll
    ├── WinRTCOMServer.exe
    └── WinRTCOMServer.winmd

Screenshots

No response

NuGet package version

1.8.260317003

Packaging type

Packaged (MSIX)

Windows version

Windows 11 version 24H2 (26100, June 2025 Update)

IDE

Visual Studio 2022

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-MSIXBuildToolsMSIX deployment technology in Microsoft.Windows.SDK.BuildTools.MSIXneeds-triage

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions