Skip to content

Commit b3389d2

Browse files
authored
Update and rename moving-to-dotnet7-and-above.md to dotnet-runtime-support.md
1 parent 02a4913 commit b3389d2

File tree

2 files changed

+49
-16
lines changed

2 files changed

+49
-16
lines changed
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
---
2+
title: ".NET runtime support"
3+
---
4+
5+
Excel-DNA continues to support .NET Framework 4.x. For the core add-in libraries the minimum version is v4.5.2, but I recommend targeting v4.7.2 (net472) or v4.8 (net48) for the best compatiiblity with libraries and Windows releases.
6+
```
7+
<TargetFramework>net472</TargetFramework>
8+
```
9+
10+
Targeting .NET core runtimes, .NET 6 (v6.0.2+) to .NET 8 are supported. This requires the ".NET Desktop Runtime" to be installed, with the platform (x64 or x86) matching the Excel installation (64-bit or 32-bit respectively).
11+
```
12+
<TargetFramework>net8.0-windows</TargetFramework>
13+
```
14+
15+
Only a single .NET core runtime can be loaded into an Excel process (this one .NET core runtime can be loaded together with the .NET Framework 4.x runtime). For an add-in developer, this means the choice of runtime can impact, and be impacted, by other add-ins targeting .NET core versions.
16+
17+
For .NET core we support the **RollForward** property, allowing the add-in developer to specify how the add-in loads the runtime or behaves if a .NET core runtime is already loaded into the process. The following RollForward settings (with .NET core target versions) give useful options.
18+
https://learn.microsoft.com/en-us/dotnet/core/versions/#net-runtime-compatibility
19+
20+
* The default value (if the RollForward property is not specified) is `Minor`, (which is equivalent to `LatestPatch` since the .NET core runtime no longer publishes 'minor' version updates).
21+
```
22+
<TargetFramework>net6.0-windows</TargetFramework>
23+
<RollForward>Minor</RollForward>
24+
```
25+
This means the add-in will only run under .NET 6.
26+
* If no .NET runtime is loaded yet, the add-in will attempt to load .NET 6.
27+
* If .NET 6 is not installed, the add-in will fail to load.
28+
* If a newer version of the runtime is already loaded into the Excel process, this add-in will fail to load.
29+
30+
* To allow forward-compatibility, the add-in can be built target .NET 6.0 and set `RollForward' to `Major`.
31+
```
32+
<TargetFramework>net6.0-windows</TargetFramework>
33+
<RollForward>Major</RollForward>
34+
```
35+
This means the add-in will load into .NET 6 and newer version of .NET, but will prefer to load .NET 6 if available. Thus
36+
* If no .NET runtime is loaded yet, .NET 6 will be loaded if it is installed.
37+
* If .NET 6 is not installed but a newer version of .NET is installed (e.g. .NET 8), the add-in will load the next available higher major version.
38+
* If a newer version of the runtime (e.g. .NET 8) is already loaded into the Excel process, the add-in will load and use that version.
39+
40+
* To allow for compatibility with a preference for the newest version, the add-in can be built target .NET 6.0 and set `RollForward' to `LatestMajor`.
41+
```
42+
<TargetFramework>net6.0-windows</TargetFramework>
43+
<RollForward>LatestMajor</RollForward>
44+
```
45+
This means the add-in will load into .NET 6 and newer version of .NET, but will prefer to load the newest version of .NET available. Thus
46+
* If no .NET runtime is loaded yet, the newest installed version of .NET will be loaded (at least .NET 6).
47+
* If any version of the runtime from .NET 6 or newer is already loaded into the Excel process, the add-in will load and use that version.
48+
49+

docs/guides-basic/moving-to-dotnet7-and-above.md

Lines changed: 0 additions & 16 deletions
This file was deleted.

0 commit comments

Comments
 (0)