This is a Demo app for the Liftoff/Vungle 7.0 SDK for WinUI 3.

This code has been created using Visual Studio 2026.


GETTING STARTED

To get started, you will need to sign up on our site at liftoff.io

Then, using our Dashboard, you can create a new "Application ID", and some Placements.

Then, compile and run the application.

Enter your application id from the previous step into the "App ID" textbox.

Click on "Start Vungle".  After a few moments, a list of Placements (the ones you created on
our Dashboard) will appear.

Click on one of these placements, then click on the "Load" button.

If an ad is available, the "Play" button will become enabled.  Click on the "Play" button to
play the ad.


NATIVE AOT

This build of the SDK supports .NET Native AOT.

It is a BETA build, version 7.0.4-beta2, supplied for evaluation ahead of the general release.
It reports that version in its User-Agent, so ad requests from it are distinguishable from
production traffic.  Functionally it is the shipping SDK plus the AOT fixes.

To produce a fully native build of this sample, with no managed SDK assembly in the output:

    dotnet publish LiftoffWinUI3DemoApp.csproj -c Release -r win-x64 -p:Platform=x64 -p:PublishAot=true

The result is a single native executable under
bin\Release\net8.0-windows10.0.19041.0\win-x64\publish\.

AOT imposes three dependency floors.  All three are already set in this sample, and all three
are breaking changes for a project still on .NET 6 or Windows App SDK 1.5:

    Target framework          net8.0-windows10.0.19041.0
    Microsoft.WindowsAppSDK   1.6.250602001 or higher
    Microsoft.Web.WebView2    1.0.4129.50 or higher

The Windows App SDK floor matters because 1.6 is the first release carrying C#/WinRT 2.1,
whose generated WinRT projections are AOT-compatible; on 1.5 an AOT-published app crashes at
startup.  The WebView2 floor matters because Windows App SDK 1.6 pins a WebView2 whose
projections predate the AOT-safe RCW factory - with that version, initialization does not
crash, it hangs.  Windows App SDK 1.6 on its own is therefore NOT sufficient.

Do not lower either floor.


UNPACKAGED AOT DEPLOYMENT

A Native AOT build of a WinUI 3 app is unpackaged - it has no MSIX package identity.  That
means it cannot acquire a Windows App Runtime at launch the way a packaged app does, so it
must carry one.  If it does not, the app faults at startup with 0xC0000409 before any of
your code runs.

This sample already sets the four properties that handle it, scoped so they only apply to
an AOT publish and leave the ordinary packaged build alone:

    <PropertyGroup Condition="'$(PublishAot)' == 'true'">
      <WindowsPackageType>None</WindowsPackageType>
      <WindowsAppSDKSelfContained>true</WindowsAppSDKSelfContained>
      <SelfContained>true</SelfContained>
      <PublishReadyToRun>false</PublishReadyToRun>
    </PropertyGroup>

WindowsAppSDKSelfContained is the one that resolves the crash; SelfContained is its
prerequisite.  Publishing this way also means the target machine needs no compatible
Windows App Runtime installed, which is usually what you want for a directly distributed
build.

If you copy this sample's SDK usage into a project of your own, copy this PropertyGroup too.


WHERE THE SDK COMES FROM

Ordinarily the SDK is distributed as the VungleSDKForWinUI3 NuGet package and restored from
nuget.org when you build.

This sample instead resolves it from the SDK\ folder shipped alongside it, via NuGet.config.
That is deliberate: resolving from a package rather than referencing the .dll directly is what
carries the three dependency floors above into your project automatically.  If you copy the
SDK .dll into a project of your own, those floors do not travel with it - you must set all
three by hand, or the app will fail in exactly the way this build fixes.


If you have any questions or comments, please contact us here:
https://github.com/Vungle/Windows-SDK/issues/38
