Upgrade from .NET 4.0 to .NET 4.7 - c#

We have some legacy apps (ASP.NET) that have been targeting the .NET 4 framework, which is out of support. Looking at some articles https://learn.microsoft.com/en-us/lifecycle/faq/dotnet-framework, it basically says we don't need to recompile our apps to target the newer version of the framework.
How do I make sure that our apps are running with the latest (.NET 4.7) framework?
Thanks.

Related

.NET Versions are retro-compatible?

I'm working on a C# Code that has as Targeted Framework .NET 4.6, and I'm trying to troubleshoot some issues that occurs during the execution.
That code is running on some clients, that has a .NET 3.5 Version.
My question is, does .NET 4.6 supports retro-compatibility, and if so, should it be wiser to have an aligned Framework versions (Target Version same as Client Version)??
TL;DR: Basically, you can run old on new, but not new on old.
DotNet 4.6+ is backwards compatible in the sense, that you can run an App built with DotNet 3.5 etc. But you cannot run an app built with DotNet 4.6+ while using an older installed framework eg. 3.5 or others. Take it this way:
Imagine you have a windows 10 computer and you want to install an app built for windows 8 or even XP and older. Modern windows has the compatibility layers, necessary to run or install the program.
Now what you/your clients are doing is basically taking an app specifically designed for windows 10, and trying to run it on Windows XP or 95 etc. That won't work as the compatibility layers are not in place to support the "future". No one can foresee the new features and API's that they might add, so the app is incompatible with older Windows.
If you are targeting .NET 4.6, then target .NET 4.6.
Do not expect your code/app to be compatible with anything lower, and if you do need it to be, you have to target that specific version. Which has its own draw-backs as the newer methods / ways of doing things and many libraries you could be using do not apply/are not compatible.
You can either update everything to use 4.6 or higher, or switch your codebase to target 3.5 and live with the drawbacks.
From Backward Compatibility
The .NET Framework 4.5 and later versions are backward-compatible with
apps that were built with earlier versions of the .NET Framework. In
other words, apps and components built with previous versions will
work without modification on the .NET Framework 4.5 and later
versions.
In your case app is built on .Net Framework 4.6 and the platform on client machine is 3.5 version. There might be some issues because app requires newer version than platform it runs.
.NET Framework version 4.6 was included with Windows 10 from version 1507 and .NET Framework version 4.6.2 was included with Windows Server 2016. If your clients are running either of these versions of Windows or newer, you won't have to install anything to run your .NET Framework 4.6 app, and it won't be running on .NET Framework 3.5 even if you do have it installed.
If you're using an older version of Windows than that and don't have .NET Framework 4.6 or newer installed, I wouldn't expect it to run at all.

.net core & .net framework in the same team

Our development team has many .net framework 4.6 projects (VS 2015).
We want to start a new .net core project to eventually deploy on linux.
We have installed VS 2017 and the .net core 2.0 preview.
But how can we reuse the existing library projects in this new one ?
We research but it is not clear for us :
- we need to change the target of the old projects from ".Net Framework 4.6" to ".NetStandard 1.x" ? (and solve the incompatibility)
- or we can use them like that ? (but how?)
Thanks
Microsoft publishes official guidelines for the porting process: https://learn.microsoft.com/en-us/dotnet/articles/core/porting/
To summarize:
Deal with your dependencies (by migrating them), recursively
Retarget your projects. Applications move to .NET core, libraries move to .NET Standard, where possible.
Use some helpful tooling to verify your ports
Test
So, to share things between .NET Framework and .NET Core, your libraries should target .NET Standard, as much as possible. Otherwise, you could possibly share the code and have to do multiple builds - build once targetting .NET Framework and again targetting .NET Core.
You can use/reference your old projects only if you target Full Framework in your new projects (which is not the case if you are going to run them on Linux).
If you started with preview you should convert you old projects to .Net Core projects and either target .NET Core 2.0 Preview or NetStandard 2.0 Preview. If you are not going to reference/use your old projects outside your application it might be better to target .NET Core 2.0 Preview because it might provide more API than NetStandard 2.0 Preview.

Porting a Prism-based WPF application to .NET Core

We have a Prism-based WPF application with over 10 man years of development invested in it.
We are moving big chunks of it into web browser control hosted modules to make it platform independent in the future.
There seems to be no UI framework to take over XAML in .NET Core.
Would it be possible to port it into .NET Core in the future?
It's looking like WPF or at the very least XAML will become part of .NET Standard 2.0 roughly Q1 2017 / Q2 2017
Immo Landwerth - Program manager on .NET at Microsoft
https://twitter.com/MikeEEE76/status/776769805722521600
Bug - Port System.Xaml to .NET Core #5766
https://github.com/dotnet/corefx/issues/5766
.NET Core Roadmap
https://blogs.msdn.microsoft.com/dotnet/2016/07/15/net-core-roadmap/
I am updating this answer as new .NET Core 3 and .NET Framework 4.8 are releasing with support of Windows Desktop Applications.
There is an update regarding .NET Core 3 and .NET Framework 4.8:
Update on .NET Core 3.0 and .NET Framework 4.8
Announcement of .NET 5 as ".NET Core vNext", the next release after .NET Core 3.0. In this announcement, Microsoft shows .NET 5 as a unifying platform for desktop, Web, cloud, mobile, gaming, IoT, and AI applications. It also shows explicit integration with all Visual Studio editions and with the command line interface (CLI). The goal of the new .NET version is to produce a single .NET runtime and framework, cross-platform, integrating the best features of .NET Core, .NET Framework, Xamarin, and Mono (the original cross-platform implementation of .NET). .NET 5 also features Java interoperability on all platforms and interoperability with Objective-C and Swift on multiple operating systems.
Image source: https://devblogs.microsoft.com/dotnet/introducing-net-5/
Still, it is clear that all future investments in .NET will be related with .NET Core, and that .NET 5 is the next step forward with .NET Core. All related development will continue to be open-source and community-oriented. The production release of .NET Core is scheduled to later this year, in September, and .NET 5 is expected on late 2020. The current .NET Core roadmap is available here.
Image source: https://devblogs.microsoft.com/dotnet/introducing-net-5/

.Net framework 4.5 is not available in windows features list

I already installed .net framework 4.6.1 in my machine but still there is no option for .net framework 4.0 or 4.5 features in Turn windows features on or off.
how i can enable features for .net framework 4.5 can any one help me to solve out this.
Thanks in advance !!!

Application Targeted for Framework 4.0 works on Framework 2.0?

If the user's PC has only Framework 2.0 installed, will Framework 4.0 work?
I installed windows 7 on my other laptop and tried to run my application built on C#, it didn't work. I figured out that my application is targeted for Framework 4.
When I ran this app on that laptop, it didn't work.. I wonder why, i thought that framework is already installed with windows. It's either it has an old Framework version ( like 2.0 ) OR it doesn't have any Framework installed.
Should I change my target to Framework 2.0 in order to make it work?
If the user's PC has only Framework 2.0 installed, will Framework 4.0 work?
If the user has only .NET 2.0 installed and you attempt to run an application compiled against .NET 4.0 it won't work.
On the other hand if the user has .NET 4.0 installed and you attempt to run an application compiled against .NET 2.0 this will work.
I am not aware of any forward compatible frameworks. Only backwards compatible. Makes sense?
Should I change my target to Framework 2.0 in order to make it work?
Yes, if you want to run your application on a computer that has only .NET 2.0 installed.

Categories