0

I have a DLL which has been built targeted for .NET framework 3.5 and used from the COM context. However in Windows 2012 R2 onwards, 3.5 framework is not present; only 4.5 is present.

Is it possible to get it to work without a rebuild on an environment without 3.5 present? I was reading about app.config setting the preferred run-time etc. If yes, where should I be placing the config file?

(I saw a few posts regarding scenarios where the executable payload is an application eg. Running .NET 3.5 apps on .NET 4 only systems)

Community
  • 1
  • 1
user412792
  • 27
  • 2
  • 1
    What have you tried? What error do you have? In general yes it should possible in this way. Did you try installing .net 3.5 ? – tafia Aug 13 '15 at 06:55
  • If we install 3.5, it works fine. However that is not an option. :( Asking people to install 3.5 just for this DLL's functionality seems like overkill. – user412792 Aug 13 '15 at 08:37

1 Answers1

0

I haven't tried it myself.

From Microsoft website https://msdn.microsoft.com/en-us/library/windows/desktop/hh848079%28v=vs.85%29.aspx

For App developers (and IT Administrators):

IT administrators can configure .NET 3.5 apps to run on either .NET 3.5 or .NET 4.5 (depending on what's already installed). In order to run a managed app on either 3.5 or 4.5, just add a section in the application configuration file. This will ensure that if .NET 3.5 is installed, the app will run on .NET 3.5; otherwise the app will run on .NET 4.5. An example of the additional section in the configuration file is provided below:

<configuration>
   <startup>
      <supportedRuntime version="v2.0.50727"/>
      <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5"/>
   </startup>
</configuration>
Community
  • 1
  • 1
tafia
  • 1,512
  • 9
  • 18
  • You ought to try it yourself. An app.exe.config file is pretty troublesome in a COM server scenario. The .exe is some arbitrary app that is *not* a .NET app and often cannot or should not be tinkered with. Particularly if the dead-simple solution is not permitted. – Hans Passant Aug 15 '15 at 08:23