Hi Daniil,
I think the exact runtime version control feature you're looking for is only implemented in Excel-DNA v1.9.0.
Suppose you want to target a specific .NET runtime build. Then you would configure like this in the project file.
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0-windows</TargetFramework>
<RuntimeFrameworkVersion>8.0.6</RuntimeFrameworkVersion>
<RollForward>Disable</RollForward>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="ExcelDna.AddIn" Version="1.9.0-beta1" />
</ItemGroup>
</Project>
You'll see the version and RollForward option reflected in the generated .runtimeconfig.json file
"runtimeOptions": {
"tfm": "net8.0",
"rollForward": "Disable", "framework": {
"name": "
Microsoft.NETCore.App",
"version": "8.0.6" },
"configProperties": {
"System.Runtime.Serialization.EnableUnsafeBinaryFormatterSerialization": false
}
}
}
And also in the generated .dna file (generated by the build when you don't have a .dna file in your project directory)
<DnaLibrary
RuntimeFrameworkVersion="8.0.6" RollForward="Disable" Name="TestExactVersion Add-In" RuntimeVersion="v8.0" xmlns="
http://schemas.excel-dna.net/addin/2020/07/dnalibrary">
<ExternalLibrary Path="TestExactVersion.dll" ExplicitExports="false" LoadFromBytes="true" Pack="true" IncludePdb="false" />
</DnaLibrary>
Then when loading the add-in, if the matching runtime version cannot be loaded, you should see a clear error message.
You can also use other RollForward options like "LatestPatch" as expected.
-Govert