I created a console application with a target framework of .net 6.0 in order to write a custom Xaml writer. This is the project configuration:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
I want to extend the XamlXmlWriter
class but I can't import it. If I add using System.Xaml
I get: The type or namespace Xaml does not exist in the namespace System
. What am I missing?
You need two changes to your project file:
<UseWPF>true</UseWPF>
as an additional propertyAs per the documentation, it looks like XamlXmlWriter
is available in the Windows Desktop framework for .NET 6, but not in "general" .NET 6.