Home > Software design >  Using VB.NET Tuples in an Office VSTO solution, understanding .NET Framework 4.7 dependencies
Using VB.NET Tuples in an Office VSTO solution, understanding .NET Framework 4.7 dependencies

Time:02-15

For a VB.NET Office VSTO solution, I would like to start using Tuples.

What worries me somewhat is this requirement in terms of .NET Framework.

VB.NET Tuples are not supported until .NET Framework 4.7, see Microsoft info here.

I don't mind requiring .NET Framework 4.7 or higher, but I worry about problems with other VSTO addins running in the Office application (in this case Visio, but also developing for Excel) that require older versions of .NET.

So far I have limited the solution to using .NET Framework 3.5 compatible features. I don't mind requiring .NET Framework 4.7 or higher be installed but I want to avoid issues with other VSTO add-ins that are running at the same time.

What happens when multiple Office VSTO add-ins are running at the same time but require different .NET Frameworks? I cannot find clear info about this on the Microsoft website.

Thank you for sharing your insights!

CodePudding user response:

You won't have any problems - all VSTO addins run in their own environment with the exact version of .Net run-time that the addin requests. Multiple versions of .Net run-time can be loaded in a given process (outlook.exe).

CodePudding user response:

VSTO add-ins are run in separate application domains. So, your add-ins can use different .net framework versions. But the CLR is the same. And I'll explain why...

The CLR is the same as other DLLs: there is only one copy of the CLR code in RAM. That copy is mapped into the virtual memory pages for each process executing CLR code. Pages containing CLR data (heap etc) are unique per process (and AppDomain).

So, you can't run multiple CLR versions in the same process (not .net framework versions). But you can configure the target CLR in the host application configuration file.

If the application configuration file includes entries that specify one or more .NET Framework versions, and one of those versions is present on the user's computer, the app runs on that version. The configuration file reads entries in the order they are listed, and uses the first .NET Framework version listed that is present on the user's computer. (Use the element for version 1.0.)

You can find the CLR Inside Out - In-Process Side-by-Side article helpful.

  • Related