I am following the guide here, but I am using a C++ WinRT UWP project to consume the C# component instead of the C++ WinRT console project in the guide.
However, it failed to add the C# component project as a project reference.
My .csproj
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<TargetFramework>net6.0-windows10.0.22000.0</TargetFramework>
</PropertyGroup>
<PropertyGroup>
<CsWinRTComponent>true</CsWinRTComponent>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Windows.CsWinRT" Version="2.0.1" />
</ItemGroup>
</Project>
I also tried to add the winmd
file from the C# component, but I am stuck when adding
<Extensions>
<Extension Category="windows.activatableClass.inProcessServer">
<InProcessServer>
<Path>WinRT.Host.dll</Path>
<ActivatableClass ActivatableClassId="CSharpComponent.Class1" ThreadingModel="both" />
</InProcessServer>
</Extension>
</Extensions>