In the past I've written all my custom actions in VBScript, because my understanding is that this (and JScript) is the only type of custom action which does not require additional prerequisites on the target system.
However, writing VBScript is a pain, and now I also encountered a problem which apparently cannot be solved in VBScript (see Currupted file in non-english locale (encoding problem?)).
So I'm considering using a C# custom action instead. But I don't want to introduce additional prerequisites just for the custom action (note that the application I'm installing does not use the .NET Framework).
This list shows which Windows version includes which .NET Framework version. Assuming that newer .NET Framework versions are backwards compatible, it looks like a .NET Framework 2.0 custom action should run on virtually any Windows version (except for XP, which I don't care about) out of the box. But then on this site it says
In addition, if your app targets version 2.0, 3.0, or 3.5, your users may be required to enable the .NET Framework 3.5 on a Windows 8, Windows 8.1, or Windows 10 computer before they can run your app.
So it looks like the assumption that newer .NET Framework versions are backwards compatible is not correct...
The WiX custom action project created a CustomAction.config file with the following settings:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup useLegacyV2RuntimeActivationPolicy="true">
<supportedRuntime version="v4.0" />
<supportedRuntime version="v2.0.50727"/>
</startup>
</configuration>
So here are a few questions:
- Can I assume that a .NET Framework 2.0 custom action with the above config runs on any Windows (except for XP)? Or does .NET Framework 3.5 need to be enabled on newer versions of Windows despite the fact that the config file states 4.0 as a supported runtime?
- What's generally speaking the best way to create a custom action (not VBScript or JScript) without introducing any additional prerequisites? (I was considering a "C++ Custom Action Project for WiX v3", but it looks like this creates a managed C++ project, so the same questions around .NET Framework arise).
Update:
I tested this .NET Framework 2.0 custom action in a fresh Windows Server 2008 R2 and in a fresh Windows 10 VM. The custom action ran without needing to install the .NET Framework manually. So based on this little test it looks like compatibility of such a custom action is quite good.