0

I have a Visual Studio solution with mixed mode. Some projects are .Net Framework 4.0 while others are .Net Framework 2. This was solved by adding an app.config with:

<?xml version="1.0"?>
<configuration>
  <startup useLegacyV2RuntimeActivationPolicy="true">

  <supportedRuntime         version="v4.0"sku=".NETFramework,Version=v4.0,Profile=Client"/></startup>
</configuration>

However, when I deploy this into an installation, it doesn't work. It gives out the message: 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 have tried to add the app.config to the installation ( so the file ends up in Program Files/..., and also renamed it app.exe.config. (I thought an app.exe.config would be created in the build, but it wasn't). The installation also contains a file "myApp".exe.config which contains the same as the app.config. This doesn't help either.

Per Helge
  • 1
  • 2
  • Clearly your .config file is not actually being used by the CLR. Not that clear why but app.exe.config certainly can't work. And those double-quotes look too flaky to be right and having more than one doesn't make any sense. Maybe SysInternals' Process Monitor can help, its trace shows your app searching for the config file. Do beware the install location, an app that is forced to run in 32-bit mode (the default) must be installed in c:\program files (x86). – Hans Passant Mar 14 '16 at 09:12
  • Why do you say that "app.exe.config certainly can't work"? I have read other places that this is the file that should be added in the deployment. What do you mean by "flaky"? There are not any consecutive quotes in there. – Per Helge Mar 16 '16 at 08:21
  • The filename must match the EXE file. So it is mumble.exe.config to match mumble.exe. This normally always happens correctly when you right-click the EXE Project > Add > New Item > Application Configuration File. That it doesn't might be part of the problem but there's no hint at all. – Hans Passant Mar 16 '16 at 08:30
  • OK, I understand. That was what I meant by "myApp". When my application is called "Resusci.exe", there is a file called "Resusci.exe.config". Which contains what I wrote in the original message. I added it into the app.config in one of my projects, and it ended up in Resusci.exe.config. So that sounds good right? So I don't really need a app.config or app.exe.config to end up in the installation? Still it does not work when installed for some reason. Yes, it is installed in the c:\program files (x86) – Per Helge Mar 18 '16 at 09:46
  • It turns out that if I'm running the application as administrator, the config-file works, and everything is OK. If I don't do that, the config-file does not seem to be read correctly. ( The Process Monitor marks it as "REPARSE") – Per Helge Mar 21 '16 at 13:11

0 Answers0