Configuration Files on .NET 4 Managed C++ DLL's RRS feed

  • Question

  • I have a .NET 4 application written in C# that I've been attempting to interface with an unmanaged C++ project. The .NET application is handling this with the structure below:

    .NET 4 Project

    • C# Solution
    • Managed C++ Wrapper

    Unmanaged C++ Project

    • Controller to Access the Managed Wrapper

    My question is not how to interface the various components -- I have successfully done so already. However, because the solution is .NET 4, a configuration file must be added in order to get the CLI bindings to work correctly. This is the configuration file:

    <startup useLegacyV2RuntimeActivationPolicy="true">
    <supportedRuntime version="v4.0"/>

    I have prototyped this successfully with a C++ console application and the only way it would work without exception was to include that configuration file in the executable directory. This is obviously not possible for the unmanaged C++ application.

    In the interim, I have reverted the application to use .NET 3.5 instead of .NET 4 and this has solved the issue. However, our application already has a .NET 4 module that communicates with the C++ application via COM. To have both .NET versions required  will increase the install size of our application considerably and is an undesired consequence. We do not want to implement this module via COM for various reasons so we are left with few options.

    My questions is: Is it possible to apply this configuration directly to a DLL without affecting the entire application? Everything I've read about the situation points toward the answer being a resounding negative but I wanted to get another opinion.

    Thanks in advance.

    Wednesday, August 31, 2011 2:57 PM