Let us assume a .csproj containing the following:
<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <TargetFramework>net10.0-windows</TargetFramework>
    <ImplicitUsings>enable</ImplicitUsings>
    <Nullable>enable</Nullable>
  </PropertyGroup>
  <ItemGroup>
    <PackageReference Include="ExcelDna.AddIn" Version="1.9.0-rc3" />
  </ItemGroup>
</Project>
With a simple MyFunctions.cs file containing:
using ExcelDna.Integration;
namespace ExcelDNAProject1;
public static class MyFunctions
{
    [ExcelFunction(Description = "Hello .NET 10.0 world!")]
    public static string SayHello(string name)
    {
        return "Hello " + name;
    }
}
This results in a .xll file that will cause this error message to appear:
 
This machine does have .Net Desktop Runtime 10.0.0 (preview 7) version installed. So this is strange.
However, if RuntimeFrameworkVersion is specified in said .csproj file:
<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <TargetFramework>net10.0-windows</TargetFramework>
    <RuntimeFrameworkVersion>10.0.0-preview.7.25380.108</RuntimeFrameworkVersion>
    <ImplicitUsings>enable</ImplicitUsings>
    <Nullable>enable</Nullable>
  </PropertyGroup>
  <ItemGroup>
    <PackageReference Include="ExcelDna.AddIn" Version="1.9.0-rc3" />
  </ItemGroup>
</Project>
This results in a working .xll file.
I should note that I've only tested this using both Debug and Release configurations, same results each time.