This answer eliminates the side-by-side error message at the time the application is activated but I do not know enough about the issue to be able to say if it is close to being a good answer.
This answer assumes that Excel Interop is provided by Visual Studio 2013's Add Reference > COM
, where there is a reference called Microsoft Excel 15.0 Object Library (Version 1.8)
.
For the Application's .EXE, create a Visual Studio App.config
and include within it the following element.
<startup useLegacyV2RuntimeActivationPolicy="true">
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
</startup>
Do the same for every .DLL dependency in your solution. If a library is being built, VS 2013 does not create the App.config
by default, but it is easily generated by right clicking the project in the solution browser.
By setting the useLegacyV2RuntimeActivationPolicy
attribute to true
, the message side-by-side configuration is incorrect
, and the dialog that bears it at the time of activation, ceases to appear.
When it is true
the following quote applies.
Enable .NET Framework 2.0 runtime activation policy for the chosen runtime, which is to bind legacy runtime activation techniques (such as the CorBindToRuntimeEx function) to the runtime chosen from the configuration file instead of capping them at CLR version 2.0. Thus, if CLR version 4 or later is chosen from the configuration file, mixed-mode assemblies created with earlier versions of the .NET Framework are loaded with the chosen CLR version. Setting this value prevents CLR version 1.1 or CLR version 2.0 from loading into the same process, effectively disabling the in-process side-by-side feature.
When it is false
, the following quote applies.
Use the default activation policy for the .NET Framework 4 and later, which is to allow legacy runtime activation techniques to load CLR version 1.1 or 2.0 into the process. Setting this value prevents mixed-mode assemblies from loading into the .NET Framework 4 or later unless they were built with the .NET Framework 4 or later. This value is the default.
The value of v4.0
and the sku
value were simply the defaults by Visual Studio 2013 (on a system with .NET Framework 4.5.1 installed) when a WPF application was generated so the actual values might vary depending upon which version of the IDE you are using. The example values of v4.0
and the sku
value might need to be adjusted for the particular circumstances.
Links: