When preparing the demonstration for my session for Dataverse Summit 2022, I encountered an error when registering the Plugin package. The error is “Could not load file or assembly ‘xxx’ or one of its dependencies. A strongly-named assembly is required.“. The error thrown is because of the solution structure below:

As you can see from the above image, I made two .NET projects (and one test project but we will not count it for the actual implementation). One is specialized for the plugins (inherited from IPlugin). While all the business logic and core functionality will be on the Lib project. With this setup, Demo.csproj will have a reference to the Lib project as you can see below Demo.csproj content:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net462</TargetFramework>
<PowerAppsTargetsPath>$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v$(VisualStudioVersion)\PowerApps</PowerAppsTargetsPath>
<SignAssembly>true</SignAssembly>
<AssemblyOriginatorKeyFile>DemoPlugin.snk</AssemblyOriginatorKeyFile>
<AssemblyVersion>1.0.0.0</AssemblyVersion>
<FileVersion>1.0.0.0</FileVersion>
<ProjectTypeGuids>{4C25E9B5-9FA6-436c-8E19-B395D2A65FAF};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
</PropertyGroup>
<Import Project="$(PowerAppsTargetsPath)\Microsoft.PowerApps.VisualStudio.Plugin.props" Condition="Exists('$(PowerAppsTargetsPath)\Microsoft.PowerApps.VisualStudio.Plugin.props')" />
<!--
NuGet pack and restore as MSBuild targets reference:
https://docs.microsoft.com/en-us/nuget/reference/msbuild-targets
-->
<PropertyGroup>
<PackageId>DemoPlugin</PackageId>
<Version>$(FileVersion)</Version>
<Authors>Temmy Raharjo</Authors>
<Company>MyCompany</Company>
<Description>This is a sample nuget package which contains a Dataverse plugin and its runtime dependencies like Newtonsoft.Json</Description>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.CrmSdk.CoreAssemblies" Version="9.0.2.*" PrivateAssets="All" />
<PackageReference Include="Microsoft.PowerApps.MSBuild.Plugin" Version="1.*" PrivateAssets="All" />
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" Version="1.0.*" PrivateAssets="All" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Lib\Lib.csproj" />
</ItemGroup>
<Import Project="$(PowerAppsTargetsPath)\Microsoft.PowerApps.VisualStudio.Plugin.targets" Condition="Exists('$(PowerAppsTargetsPath)\Microsoft.PowerApps.VisualStudio.Plugin.targets')" />
</Project>
When I want to register the Plugin package, here is the screenshot of the error:

Solution
To fix the above error, it’s pretty simple. You only need to go to the DemoPlugin > Dependencies > Projects > then select your required project (in this case is Lib) > right click and click Properties > on the Reference Output Assembly set as Yes and set Copy Local to Yes:

This is the full DemoPlugin.csproj content after we did the above changes:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net462</TargetFramework>
<PowerAppsTargetsPath>$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v$(VisualStudioVersion)\PowerApps</PowerAppsTargetsPath>
<SignAssembly>true</SignAssembly>
<AssemblyOriginatorKeyFile>DemoPlugin.snk</AssemblyOriginatorKeyFile>
<AssemblyVersion>1.0.0.0</AssemblyVersion>
<FileVersion>1.0.0.0</FileVersion>
<ProjectTypeGuids>{4C25E9B5-9FA6-436c-8E19-B395D2A65FAF};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
</PropertyGroup>
<Import Project="$(PowerAppsTargetsPath)\Microsoft.PowerApps.VisualStudio.Plugin.props" Condition="Exists('$(PowerAppsTargetsPath)\Microsoft.PowerApps.VisualStudio.Plugin.props')" />
<!--
NuGet pack and restore as MSBuild targets reference:
https://docs.microsoft.com/en-us/nuget/reference/msbuild-targets
-->
<PropertyGroup>
<PackageId>DemoPlugin</PackageId>
<Version>$(FileVersion)</Version>
<Authors>Temmy Raharjo</Authors>
<Company>MyCompany</Company>
<Description>This is a sample nuget package which contains a Dataverse plugin and its runtime dependencies like Newtonsoft.Json</Description>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.CrmSdk.CoreAssemblies" Version="9.0.2.*" PrivateAssets="All" />
<PackageReference Include="Microsoft.PowerApps.MSBuild.Plugin" Version="1.*" PrivateAssets="All" />
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" Version="1.0.*" PrivateAssets="All" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Lib\Lib.csproj">
<ReferenceOutputAssembly>True</ReferenceOutputAssembly>
<Private>True</Private>
</ProjectReference>
</ItemGroup>
<Import Project="$(PowerAppsTargetsPath)\Microsoft.PowerApps.VisualStudio.Plugin.targets" Condition="Exists('$(PowerAppsTargetsPath)\Microsoft.PowerApps.VisualStudio.Plugin.targets')" />
</Project>
After we did the above, you only need to rebuild the solution and retry again to register the Plugin Package (And it should work!).
All the source code you can check in this GitHub repo.
Happy CRM-ing!