Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Running .NET 3.5 apps on .NET 4 only systems

This question has been asked before perhaps multiple times, but I can't get the typical solution to work for me. The proposed solution is to put this in the "app.config" file:

<configuration>
   <startup>
      <supportedRuntime version="v4.0"/>
   </startup>
</configuration>

But with a simple "Hello World" program, I still get the error: "Unable to find a version of the runtime to run this application.".

For some background, I'm using Windows XP (through Windows Virtual PC on Windows 7), and only installed the .NET 4.0 runtime on XP.

After some research, I found this page: http://msdn.microsoft.com/en-us/library/ee941656.aspx#core

It mentioned "If your application configuration file is named application-name.config, rename it to application-name.exe.config. For example, rename MyApp.config to MyApp.exe.config.".

I tried that, thinking it could solve the issue, but I still get "Unable to find a version of the runtime to run this application." when I try to run the .NET 3.5 (client profile or full) application on WinXP with .NET 4.0.

like image 840
Dan W Avatar asked Mar 31 '12 21:03

Dan W


People also ask

Can you install .NET 3.5 if 4.0 is already installed?

Yes. You can install and run multiple versions of the . NET Framework on a computer. You can install the versions in any order.

Is .NET framework 3.5 Required?

You may need the .NET Framework 3.5 to run an app on Windows 11, Windows 10, Windows 8.1, and Windows 8. You can also use these instructions for earlier Windows versions.

Are .NET versions backwards compatible?

2, 4.6, 4.6. 1, 4.6. 2, and 4.7) are backward-compatible with apps that were built with earlier versions of the . NET Framework.


1 Answers

I cracked it. This might sound daft, but it turns out that the config file needed to be with the final executable in the user's folder. After all my researching, this didn't appear to be clarified anywhere. I was thinking it was only used for compiling purposes to be in the developer's folder.

In the VS editor file list, it can remain as "app.config". However, when compiled, VS automatically creates "{ProgramName}.exe.config" instead (and puts it in the bin/release folder). This is the file that needs to go in the end user's folder along with the executable.

To summarize, yes, it is possible to run a .NET 3.5 app on a system which only has .NET 4.0 installed.

like image 162
Dan W Avatar answered Nov 02 '22 12:11

Dan W