Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Target .NET 4.0 but .NET 4.5 is required

We recently moved to VS 2012, but we are required to keep on using .NET 4.0. A large part of our customer base is still using XP and .NET 4.5 is not supported on Windows XP.

Now, all projects in the solution are targeting .NET 4.0 or lower. When we run the application it tells us to install the .NET 4.5 Framework, while only the .NET 4.0 is used?

In the generated config file I see:

<startup>
    <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
</startup>

If I change Version=v4.5 to Version=v4.0 manually in the config file, everything works fine and we can run the application, however it seems weird to have to do this? Can somebody explain to me what is causing the solution to ask for 4.5 while we develop for 4.0?

like image 340
Enrico Avatar asked Nov 03 '12 23:11

Enrico


1 Answers

This XML content is automatically created inside app.config file when you create .NET Framework 4.5 project using Visual Studio 2012. When you re-target your project to .NET Framework 4, these entries are also reverted in app.config file. It looks like your app.config entry was not reverted for some reason. It's OK to manually edit the file (as you have done). Your projects will not ask for .NET Framework 4.5 anymore.

like image 166
Varun Avatar answered Oct 27 '22 09:10

Varun