Create SDK Project
We first need an SDK library for loading plugins and providing APIs for plugins.
Create SDK Project
Create a new WinUI class library in VS.
This article uses a project named ShadowExample.Core as an example.

After creation, open the .csproj file and add the following code:
xml
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net6.0-windows10.0.19041.0</TargetFramework>
<TargetPlatformMinVersion>10.0.17763.0</TargetPlatformMinVersion>
<RootNamespace>ShadowExample.Core</RootNamespace>
<RuntimeIdentifiers>win10-x86;win10-x64;win10-arm64</RuntimeIdentifiers>
<UseWinUI>true</UseWinUI>
<NoWarn>MSB3277</NoWarn>
<LangVersion>12</LangVersion>
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
<!-- Regular Nuget properties -->
<Version>1.0.0.34</Version>
<PackageId>ShadowExample.Core</PackageId>
<Authors>kitUIN</Authors>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<PackageProjectUrl>https://github.com/kitUIN/ShadowPluginLoader.WinUI</PackageProjectUrl>
<RepositoryUrl>https://github.com/kitUIN/ShadowPluginLoader.WinUI</RepositoryUrl>
<Description>✨ ShadowExample.Core ✨</Description>
<Copyright>Copyright 2024</Copyright>
<PackageTags>kitUIN;wasdk;plugin-loader;plugin;extension;winui</PackageTags>
<PackageOutputPath>..\NugetPackages</PackageOutputPath>
<!-- <PackageReadmeFile>README.md</PackageReadmeFile> -->
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.WindowsAppSDK" Version="1.4.230913002" />
<PackageReference Include="Microsoft.Windows.SDK.BuildTools" Version="10.0.22621.755" />
<PackageReference Include="ShadowPluginLoader.WinUI" Version="<Fill in latest version>" />
</ItemGroup>
</Project>Where:
CopyLocalLockFileAssembliesexports files from dependency libraries to prevent missing libraries during metadata pre-generationShadowPluginLoader.WinUIis our required dependency libraryGeneratePackageOnBuildset totruewill automatically package asnugetpackage during buildLangVersionis the C# version number, requires12or higherVersionis the program/nuget version numberPackageIdis the nuget package nameAuthorsis the nuget package authorPackageLicenseExpressionis the nuget package licensePackageProjectUrlis the nuget package project URLRepositoryUrlis the nuget package repository URLDescriptionis the nuget package descriptionCopyrightis the nuget package copyrightPackageTagsis the nuget package tagsPackageOutputPathis the nuget package output path
Note
- The content below
<!-- Nuget -->are settings for generatingnugetpackages - For MSBuild nuget generation, see: Creating NuGet packages using MSBuild
- For available MSBuild properties, see: Package targets
After creating the project, we can directly build it, and a Tools.Config.props file will appear in this directory.
Note
For the Tools.Config.props file, see: Tools.Config.props
Set <IsPluginLoader> to true to indicate this project is a plugin loader project:
xml
<?xml version="1.0" encoding="utf-8" ?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<!-- Whether the current project is a PluginLoader -->
<IsPluginLoader>true</IsPluginLoader>
<!-- Whether the current project is a Plugin -->
<IsPlugin>false</IsPlugin>
<!-- Auto Pack Plugin -->
<AutoPluginPackage>true</AutoPluginPackage>
<!-- Auto Generate I18N -->
<AutoGenerateI18N>true</AutoGenerateI18N>
</PropertyGroup>
</Project>Content
Your PluginLoader library (can be called SDK) needs to provide plugin information for the main application and all plugins, and should include: