Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Application crash after moving from .NET 3.5 to .NET 4.0

Tags:

c#

.net

Recently I upgraded .NET from 3.5 to 4.0 in my desktop application. On my development machine it works fine.

On some production machines it crashes right at start.

  1. Windows 8.1, Windows 7

    Problem Event Name: APPCRASH
    Application Name: myApp.exe
    Application Version: 2.0.0.0
    Application Timestamp: 553a56e8
    Fault Module Name: KERNELBASE.dll
    Fault Module Version: 6.3.9600.17415
    Fault Module Timestamp: 54504ade
    Exception Code: e0434f4d
    Exception Offset: 00014598
    OS Version: 6.3.9600.2.0.0.256.4
    Locale ID: 1045

  2. Windows XP SP3 with .NET 4.0

Faulting application myApp.exe, version 2.0.0.0, stamp 553a56e8, faulting module kernel32.dll, version 5.1.2600.6532, stamp 53203b53, debug? 0, fault address 0x00012fd3.

Enter image description here

Please note that the source is .NET Runtime 2.0 Error. Why?

The application is compiled in .NET 4.0, which is installed on the machine.

Another (much smaller and simpler) application from this solution, which is also compiled for .NET 4.0 works fine.

Any ideas?

like image 886
Andrzej Gis Avatar asked Apr 28 '15 14:04

Andrzej Gis


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 3.5 still needed?

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.

Why is Net Framework 3.5 not installing?

Here we show you how to solve this issue. First, you can check if the component is already installed on your device. Go to Control Panel > Programs > Turn Windows features on or off, verify if . NET Framework 3.5 checkbox is selected and then proceed with the software installation.


1 Answers

You have to change the runtime .NET version in file App.config/web.config to:

<startup>
    <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/>
</startup>
like image 192
michalczukm Avatar answered Oct 07 '22 13:10

michalczukm