net framework 4.0 compatibility
DESCRIPTION
The .NET framework compatibility research presentation for pre-upgrading.TRANSCRIPT
.NET Framework Compatibility
support .NET 4.0 with PowerBuilder
Samuel Chen
.NET Framework 4.0 is highly compatible.
Which means it does NOT fully backward compatible.
1.Legacy feature2.New feature3.Undefined behavior change.4.Bug fixing
Microsoft highly recommended to use the appropriate .NET version which the application was built against.
An earlier application(.exe) can not run over .NET 4.0.
But an earlier assembly/lib(.dll) can run as a part of a 4.0 app.
Runs against another version of .NET framework
add to appname.exe.config
<?xml version="1.0"?><configuration>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/></startup>
</configuration>
Runs against latest version of .NET framework
Add a Key "OnlyUseLatestCLR"=dword:00000001 in registry.
· On 32-bit computers, set the registry key under the following node:[HKEY_LOCAL_COMPUTER\SOFTWARE\Microsoft\.NETFramework]
· On 64-bit computers that are running 32-bit applications, set the registry key under the following node:[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\.NETFramework]
· On 64-bit computers that are running 64-bit and 32-bit managed applications, set the registry key under both of the following nodes:[HKEY_LOCAL_COMPUTER\SOFTWARE\Microsoft\.NETFramework][HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\ Microsoft\.NET Framework]
Everywhere we see
"Report bug to me if it crashes!"
Microsoft
New compatibility strategy : In-Process Side by Side
Component A is developed against .NET 1.1Component B ............................... .NET 2.0Component C ............................... .NET 4.0
Run in same process.
But In-Proc SxS only available on 4.0 or later.
So 1.1 and 2.0 in same process -- NO 1.1/2.0 and 4.0/later in same process -- YES
Difference in ASP.NET
To deploy a web app targets earlier version, We must configure the application in IIS to use the targeted version of the .NET Framework.
Difference in ASP.NET
To deploy an web app contains a nested app targets to diff version of the CLR, does In-Proc SxS work?
If an IIS Web application that targets the .NET Framework 3.5 or earlier is nested within an IIS Web application that targets the .NET Framework 4, the compiler might report errors when it compiles the nested application.
Versions before 4 do not support.
Difference in ASP.NET
To run an web app contains components targets multi-versions of the CLR?
ASP.NET app runs in application pool. A pool runs in a process. One version, one pool. (CLR)It is not possible to run multi-version of the CLR in same pool even .NET 4 supports in-proc side by side.
So for ASP.NET application, we need to
• Install the target .NET framework• Config the application to target to correct
CLR
Resolution 1
• Request customer to install appropriate .NET framework.
Safe and stable.
Resolution 2
• Generate app.config for winform applications.
Unsafe, unstable and may not work for most enterprise applications.
Resolution 3
• Support deploying to different versions of the CLR.
• Maintain multi-sets of our assemblies. • Provide config option to choose which
version of the CLR to build against.
Safe, stable but need more effort.
Microsoft is not going to support 3.5 and earlier versions from now on.
Resources:
http://msdn.microsoft.com/en-us/library/ms171868(VS.100).aspx
http://msdn.microsoft.com/en-us/library/dd889541.aspx
http://msdn.microsoft.com/en-us/magazine/ee819091.aspx
http://msdn.microsoft.com/en-US/library/dd329360.aspx
http://msdn.microsoft.com/en-US/library/dd329554.aspx
http://www.infoq.com/news/2010/04/Migration-Issues-.NET-4.0
http://blogs.msdn.com/silverlightshanghai/archive/2009/08/25/net-4-0-in-process-side-by-side.aspx (zh-cn)
Thanks !