How do you go about migrating from an older .NET Framework to .NET Framework 4? With .NET Framework 4 migration is actually pretty easy.
The migration story actually starts with how .NET 4 is installed. .NET 4 is installed as a side by side release. This means in most cases it lives in a separate directory structure from .NET 2.0/3.0/3.5. There are around a dozen or so files that are shared by .NET Framework and .NET 2.0, 3.0 and 3.5 Frameworks. The impact of this design decision for developers is that older programs should continue to run without any change or problem. By default the Framework chooses to run your program on the Framework it was written to run.
The reason for not automatically running older programs on .NET 4 is due to potential breaking changes. In building .NET 4 another decision that was made is that breaking changes would be allowed. In other words, if a new feature or bug fix could break older programs and it was the right thing to do then the change was allowed. The impact is that running some programs on Framework 4 will be broken. This gives you three ways to migrate to Framework 4:
- Do nothing and just run on older Frameworks even with .NET 4 installed.
- Run on .NET 4
One way to migrate to .NET 4 immediately is to tell the Framework to run it on the new Framework. This can be accomplished by creating a configuration file for the application. It needs a supportedRuntime node. This node will tell the mscoree what minimum CLR and Framework to use to run the application. The version node tells the version of the CLR to use either v2.0.50727 or v4.0.
The sku node tells it what SKU or Framework to use. Your options depend on the version node.
- CLR 2.0 based Framework - version="v2.0.50727"
- Full Framework - no sku node
- Client sku - sku="Client"
- Server Core - sku="Server Core"
- CLR 4 based Framework - version="v4.0"
- Full Framework - sku=".NETFramework,Version=v4.0"
- Client sku - sku=".NETFramework,Version=v4.0,Profile=Client"
The option for moving to .NET 4 is by recompiling the source code. The available migration strategy are as follows:
- Option 1 - do nothing. I do not recommend this. At the very least you should test and ensure that if the .NET Framework 4 is installed that your applications continue to run without problem.
- Option 2 - write new programs using .NET 4. This strategy is used to slowly migrate to .NET 4 without having to convert all programs to .NET 4. This is the strategy I recommend. It allows you to migrate at your leisure to .NET 4 without having to mass move everything.
- Option 3 - adopt .NET 4 and migrate all programs to .NET 4 using app config or recompiling the applications. This would be done to standardize on a single Framework.
Good luck.
Comments