ExelDna runtime version

122 views
Skip to first unread message

Dan

unread,
Mar 11, 2025, 9:29:29 AM3/11/25
to Excel-DNA
My name is Daniil and I am writing to you to ask about how to change the target runtime version. 'Cos I am changing my .csproj file with:
  <ExcelDnaRuntimeVersion>v8.0.12</ExcelDnaRuntimeVersion> ?????????? (not sure about that, it's not supporting)
  <RollForward>LatestPatch</RollForward>
and nothing has changed. I am opening the target location of build, opening .dna and runtimeconfig.json files and they are "v8.0". 

If you can help me, just let me know. I am counting on you.

Best regards,
Daniil

Govert van Drimmelen

unread,
Mar 12, 2025, 5:12:14 AM3/12/25
to Excel-DNA
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

langdexuming321

unread,
Mar 15, 2025, 3:44:45 AM3/15/25
to exce...@googlegroups.com
Does Excel support 3D reference types?

Govert van Drimmelen <govert.va...@gmail.com> 于2025年3月12日周三 17:12写道:
--
You received this message because you are subscribed to the Google Groups "Excel-DNA" group.
To unsubscribe from this group and stop receiving emails from it, send an email to exceldna+u...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/exceldna/2c1dd870-877a-4858-ac92-7689f24c1604n%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages