I have a Windows installer project which includes a custom action. This custom action uses SMO to configure a databse. The installer project is .Net 4. When executing the custom action, I get the following error:
Mixed mode assembly is built against version 'v2.0.50727' of the runtime
and cannot be loaded in the 4.0 runtime without additional configuration information.
I could run the database update code in a separate executable or rewrite the custom action so SMO is not used but I'd rather keep the code as it is if possible.
I know how to fix this in console and Winforms apps by adding the following to the app.config file.
<?xml version="1.0"?>
<configuration>
<startup useLegacyV2RuntimeActivationPolicy="true">
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/>
</startup>
</configuration>
The question is how on earth do I do this or something similar with an installer project? I still get this issue when all the referenced assemblies in the custom action are frame work 2 so it must be caused by the MSI itself which is .net4 according to the Fusion Log Viewer.