Skip to content

Commit

Permalink
Add minimal WinRT hello world project (#26)
Browse files Browse the repository at this point in the history
  • Loading branch information
Sergio0694 authored Jun 28, 2024
1 parent c634c83 commit 4c11e7f
Show file tree
Hide file tree
Showing 4 changed files with 57 additions and 6 deletions.
5 changes: 3 additions & 2 deletions .github/workflows/sizestats.yml
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,8 @@ jobs:
matrix:
flavor: [baseline, compare]
project: [
{ name: winrt-component-full, binary: winrt_component_full.dll }
{ name: winrt-component-full, binary: winrt_component_full.dll },
{ name: winrt-component-minimal, binary: winrt_component_minimal.dll }
]
runs-on: windows-latest
steps:
Expand All @@ -200,7 +201,7 @@ jobs:
id: artifact-upload-step
with:
retention-days: 90
name: logs-${{ matrix.project }}-${{ matrix.flavor }}-windows
name: logs-${{ matrix.project.name }}-${{ matrix.flavor }}-windows
path: |
src/${{ matrix.project.name }}/obj/x64/Release/net9.0-windows10.0.22621.0/win-x64/native/${{ matrix.project.name }}.mstat
src/${{ matrix.project.name }}/obj/x64/Release/net9.0-windows10.0.22621.0/win-x64/native/${{ matrix.project.name }}.map.xml
Expand Down
7 changes: 3 additions & 4 deletions src/winrt-component-full/winrt-component-full.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,12 @@
<!-- Size saving settings -->
<PublishAot>true</PublishAot>
<NativeLib>Shared</NativeLib>
<InvariantGlobalization>true</InvariantGlobalization>
<OptimizationPreference>Size</OptimizationPreference>
<StackTraceSupport>false</StackTraceSupport>
<UseSystemResourceKeys>true</UseSystemResourceKeys>

<!-- Workaround for a .NET 9 SDK issue -->
<SelfContained>true</SelfContained>

<!-- Suppress some expected warnings from exposed APIs -->
<NoWarn>$(NoWarn);CS0618;CS0067</NoWarn>
</PropertyGroup>

<ItemGroup>
Expand Down
11 changes: 11 additions & 0 deletions src/winrt-component-minimal/Class.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
using System;

namespace winrt_component_minimal;

public sealed partial class Class
{
public void SayHello()
{
Console.WriteLine("Hello, World! From WinRT!");
}
}
40 changes: 40 additions & 0 deletions src/winrt-component-minimal/winrt-component-minimal.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net9.0-windows10.0.22621.0</TargetFramework>
<Platforms>x64;arm64</Platforms>
<Nullable>enable</Nullable>
<AssemblyName>winrt_component_minimal</AssemblyName>

<!-- Enable building with 'dotnet msbuild' -->
<EnableMsixTooling>true</EnableMsixTooling>

<!-- CsWinRT settings -->
<WindowsSdkPackageVersion>10.0.22621.35-preview</WindowsSdkPackageVersion>
<CsWinRTComponent>true</CsWinRTComponent>

<!-- CsWinRT size saving settings -->
<CsWinRTEnableDynamicObjectsSupport>false</CsWinRTEnableDynamicObjectsSupport>
<CsWinRTUseExceptionResourceKeys>true</CsWinRTUseExceptionResourceKeys>
<CsWinRTEnableDefaultCustomTypeMappings>false</CsWinRTEnableDefaultCustomTypeMappings>
<CsWinRTEnableICustomPropertyProviderSupport>false</CsWinRTEnableICustomPropertyProviderSupport>
<CsWinRTEnableIReferenceSupport>false</CsWinRTEnableIReferenceSupport>
<CsWinRTEnableIDynamicInterfaceCastableSupport>false</CsWinRTEnableIDynamicInterfaceCastableSupport>

<!-- Size saving settings -->
<PublishAot>true</PublishAot>
<NativeLib>Shared</NativeLib>
<InvariantGlobalization>true</InvariantGlobalization>
<OptimizationPreference>Size</OptimizationPreference>
<StackTraceSupport>false</StackTraceSupport>
<UseSystemResourceKeys>true</UseSystemResourceKeys>

<!-- Workaround for a .NET 9 SDK issue -->
<SelfContained>true</SelfContained>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Windows.CsWinRT" Version="2.1.0-prerelease.240602.1" />
</ItemGroup>

</Project>

0 comments on commit 4c11e7f

Please sign in to comment.