Getting started
Step 1: Prepare your WPF project
This document uses .NET 7.0 as an example, but .NET 6.0 and above are supported by XPF
Make sure that your project has been updated/ported to net7.0-windows
and uses the new SDK csproj format.
For more information see the Microsoft How to upgrade a WPF desktop app to .NET 7 guide.
Confirm that your project runs acceptably on .NET 7 with WPF.
This step is vital. XPF will not work with the old/legacy .csproj
format or versions of .NET less than 6.0. You must first convert your project, and ensure that WPF works with modern .NET version before attempting to use XPF.
If you are running on Linux, see the linux guide before you install .NET.
See our porting tips for a more detailed run-through of this step.
Step 2: Add a NuGet.config
Create a NuGet.config
file at the root of your solution, or modify an existing one to contain the following:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<clear />
<add key="api.nuget.org" value="https://api.nuget.org/v3/index.json" />
<add key="xpf" value="https://xpf-nuget-feed.avaloniaui.net/v3/index.json" />
<add key="avalonia-nightly" value="https://nuget-feed-all.avaloniaui.net/v3/index.json" />
</packageSources>
<packageSourceCredentials>
<xpf>
<add key="Username" value="license" />
<add key="ClearTextPassword" value="<YOUR_LICENSE_KEY>" />
</xpf>
</packageSourceCredentials>
</configuration>
Step 3: Use the XPF SDK
In the executable WPF project, change the SDK to use the XPF SDK in the .csproj
. The first line:
<Project Sdk="Microsoft.NET.Sdk">
should be changed to:
<Project Sdk="Xpf.Sdk/1.4.0">