Skip to content

WAP project added a fake inProcessServer entry to manifest in the AppxManifest.xml #6351

@zhuxb711

Description

@zhuxb711

Describe the bug

I added a WinRTCOMServer exe project and referenced by the WAP project but not the entry project. However, a fake inProcessServer is added to the AppxManifest.xml automatically. Which breaks the build.

Package.appxmanifest

    <Extensions>
        <Extension Category="windows.activatableClass.inProcessServer">
            <InProcessServer>
                <Path>MyProject\WinRT.Host.dll</Path>
                <ActivatableClass ThreadingModel="both"
                                  ActivatableClassId="MyProjectTask1.TaskCore" />
                <ActivatableClass ThreadingModel="both"
                                  ActivatableClassId="MyProjectTask2.TaskCore" />
            </InProcessServer>
        </Extension>
        <Extension Category="windows.activatableClass.outOfProcessServer">
            <OutOfProcessServer ServerName="WinRTCOMServer" uap5:IdentityType="activateAsPackage" uap5:RunFullTrust="true">
                <Path>WinRTCOMServer\WinRTCOMServer.exe</Path>
                <Instancing>multipleInstances</Instancing>
                <ActivatableClass ActivatableClassId="WinRTCOMServer.MyClass1" />
                <ActivatableClass ActivatableClassId="WinRTCOMServer.MyClass2" />
            </OutOfProcessServer>
        </Extension>
    </Extensions>

AppxManifest.xml

  <Extensions>
    <Extension Category="windows.activatableClass.inProcessServer">
      <InProcessServer>
        <Path>MyProject\WinRT.Host.dll</Path>
        <ActivatableClass ThreadingModel="both" ActivatableClassId="MyProjectTask1.TaskCore" />
        <ActivatableClass ThreadingModel="both" ActivatableClassId="MyProjectTask2.TaskCore" />
      </InProcessServer>
    </Extension>
    <Extension Category="windows.activatableClass.outOfProcessServer">
      <OutOfProcessServer ServerName="WinRTCOMServer" uap5:IdentityType="activateAsPackage" uap5:RunFullTrust="true">
        <Path>WinRTCOMServer\WinRTCOMServer.exe</Path>
        <Instancing>multipleInstances</Instancing>
        <ActivatableClass ActivatableClassId="WinRTCOMServer.MyClass1" />
        <ActivatableClass ActivatableClassId="WinRTCOMServer.MyClass2" />
      </OutOfProcessServer>
    </Extension>
 
    <!--Fake inProcessServer that created automatically-->
    <Extension Category="windows.activatableClass.inProcessServer">
      <InProcessServer>
        <Path>WinRTCOMServer\WinRTCOMServer.dll</Path>
      </InProcessServer>
    </Extension>
  </Extensions>

This issue seems related to the Target RemoveWinMDRefForManifestAutoGen in the wapproj.
Therefore, the workaround below would fixed that

  <Target Name="RemoveOutOfProcWinMD" BeforeTargets="_GenerateCurrentProjectAppxManifest">
    <ItemGroup>
      <_AppxWinmdFilesToHarvest Condition="'%(FileName)' == 'WinRTCOMServer'" Remove="@(_AppxWinmdFilesToHarvest)" />
    </ItemGroup>
  </Target>

Steps to reproduce the bug

  1. Create a WinRT COM Exe Server like this, and reference the project from WAP project. No need to set as entry project.

WinRTCOMServer

<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <OutputType>WinExe</OutputType>
    <SelfContained>true</SelfContained>
    <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
    <RootNamespace>WinRTCOMServer</RootNamespace>
    <CsWin32RunAsBuildTask>true</CsWin32RunAsBuildTask>
    <DisableRuntimeMarshalling>true</DisableRuntimeMarshalling>
    <LangVersion>latest</LangVersion>
    <RuntimeIdentifiers>win-x64;win-arm64</RuntimeIdentifiers>
    <TargetFramework>net10.0-windows10.0.26100.0</TargetFramework>
    <TargetPlatformVersion>10.0.26100.0</TargetPlatformVersion>
    <TargetPlatformMinVersion>10.0.19041.0</TargetPlatformMinVersion>
    <AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
    <GenerateBindingRedirectsOutputType>true</GenerateBindingRedirectsOutputType>
    <RuntimeIdentifier Condition="'$(Platform)' == 'x64'">win-x64</RuntimeIdentifier>
    <RuntimeIdentifier Condition="'$(Platform)' == 'ARM64'">win-arm64</RuntimeIdentifier>
    <AssetTargetFallback>net10.0-windows$(TargetPlatformVersion);$(AssetTargetFallback)</AssetTargetFallback>
  </PropertyGroup>
  <PropertyGroup Label="CsWinRTInformation">
    <CsWinRTComponent>true</CsWinRTComponent>
    <CsWinRTWindowsMetadata>$(TargetWindowsVersion)</CsWinRTWindowsMetadata>
  </PropertyGroup>
  <ItemGroup>
    <PackageReference Include="Microsoft.Windows.CsWin32">
      <PrivateAssets>all</PrivateAssets>
      <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
    </PackageReference>
    <PackageReference Include="Microsoft.Windows.CsWinRT">
      <PrivateAssets>all</PrivateAssets>
      <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
    </PackageReference>
  </ItemGroup>
</Project>
  1. Build the WAP project
  2. Find the error APPX0501: Validation error. error C00CE012: App manifest validation error: The app manifest must be valid as per schema: Line 115, Column 8

Expected behavior

Do not generate a fake inProcessServer entry in the Appxmanifest.xml automotically.

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