Change the version of .NET - wpf

I use an add-on that supports version 4.5.2 of .NET but my version of .NET 4. How do I change this ? Are all versions of .NET and .NET compatible with Windows 7?

Related

How can I add the .NET framework 5.0 to Visual Studio Professional 2019?

I have downloaded and installed the new .NET framework 5.0 from this website.
But I would like to know how to add this framework to a project created on Visual Studio 2019 16.8.0.
Note:
I have launched VS installer and I have searched for the new framework, but I can't find it.
I have already opened: Project -> Properties -> Target Framework.
But the most recent framework that I got is .NET framework 4.8
How can I add the new framework to the target frameworks in Visual Studio 2019?
Update:
I have a conflict now and I would like to know what's the difference between .NET framework SDK and .NET framework Developer pack, I'm wrong in this point.
As mentioned in the link above, there is no .NET framework 5.0 in the developer pack list.
Can anyone explain this to me?
Download and install the Visual Studio 2019 SDK from the .NET Core releases site.
.NET 5.0 is continued development of .NET Core and it no longer follows the old (.NET 4 and older) targeting pack. Instead, .NET 5 is installed as an SDK into the .NET Core framework & sdk directory structure. For folks who have been doing .NET Core for some time, this feels natural, but coming from .NET 4, it's new.
Create a new .NET Core project type and set the .NET version to .NET 5.0:
There are specific .NET (not .NET Framework) project templates for Winforms and a few other project types. These will also target .NET 5 or .NET Core where appropriate:
Unfortunately, there is no magic wizard to upgrade a .NET 4 project over to .NET 5. The step-by-step guidance can be found here:
Winforms Migration from .NET 4 to .NET 5
WPF Migration from .NET 4 to .NET 5
Many ASP.NET folks have gone through these steps to move from .NET 4 to .NET Core in the past. There are many blog posts on the issues they bumped into and how they solved that. The process is very similar and there are some tools now to help you along the way.
The main steps are the same for every .NET 4 project:
Change your packages.config to <packageReference> format.
Change your project file to the new SDK project format.
Run the API Compatibility analyzers. This will tell you where to expect breaking changes.
Switch the target framework to .NET 5 in the project file
Update/change/add required nuget packages to the versions that support .NET Core/.NET 5.
Fix any build issues.
Alternatively:
Create a new .NET 5 project of the desired target type.
Add the required project configurations etc.
Add the NuGet Packages you're going to need.
Copy the sources over from your .NET 4 project. Or copy the project file into the folder where your existing project resides. It should automatically import all source files.
Fix build issues
It may be possible there won't be a NuGet package of 3rd party components you use that are compatible with .NET 5. In that case you'll need to either wait for one to be released or find an alternative. Of course, in case of open source projects, you could help them out by porting the package for them and sending a pull request.
The Migration guidance linked above gives you multiple approaches to achieve each step.

What versions of .NET and WPF, does the ModernUI framework support?

I'm working with a WPF app that was written using the ModernUI framework. I'm wondering what versions of the .NET Framework does the ModernUI support?
The ModernUI assemblies target .NET Framework 4.5 which means that the library is compatible with any version equal to or larger than 4.5.
You can confirm this by looking at the <TargetFrameworkVersion> elements in the .csproj files on GitHub:
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>

Consume .Net Core library from .Net standard project

I have a standard WPF application developed in .Net framework 4. Now, my client wants a website which I am planning to develop using .Net Core. In order to share the business logic, I need to move the database along business layer to a separate project and here I am planning to use .Net Core. So, all the layers i.e. Data/ Business/ API will be re-written using latest version of .Net Core.
Would I be able to reference business layer written in .Net Core from WPF (.Net Framework 4) project?
Any pointers will be highly appreciated.....
You should implement the common functionality in a .NET Standard library. You will then be able to reference this assembly from all apps that are compatible with the version of the .NET Standard that your common project targets.
The various .NET implementations target specific versions of .NET Standard and the following table on MSDN lists all versions of .NET Standard and the platforms supported: https://learn.microsoft.com/en-us/dotnet/standard/net-standard.
The latest version of .NET Core (currently 2.0 at the time of writing) implements .NET Standard 2.0. The oldest version of the .NET Framework that implements .NET Standard 2.0 is 4.6.1. This means that your WPF app should target 4.6.1 to be able to consume a .NET Standard 2.0 assembly.
.NET Core 1.0 and .NET Framework 4.5 support .NET Standard 1.0.
The .NET Framework 4.0 doesn't support any version of .NET Standard though so you should re-target your WPF app against (at least) .NET Framework 4.5.
Would I be able to reference business layer written in .Net Core from WPF (.Net Framework 4) project?
The answer is yes. You can try it: In Visual Studio create a WPF application project and a .NET Standard library project and then add a reference from the application project to the library project.
There will be NuGet packages that you cannot reference in your .NET Standard project because they only support full .NET Framework but most popular NuGet packages can be referenced from a .NET Standard project. Your question is also tagged [entity-framework-6]. If you want to use Entity Framework from a .NET Standard project you will have to use Entity Framework Core as Entity Framework 6 requires the full framework.
You should probably create a quick spike to determine if you can build your application how you intend to.

Building Windows Presentation Form for multiple versions of .net

I am building a windows presentation form application. The issue I have is that my co-workers have different versions of .net installed on the desktops. If I build it on my machine which has .net version which is 4.6. When another person has a lower version of .net it fails. I can build the application multiple time with different version of .net but I would like to avoid that. So is there a way in Visual Studio to build a WPF that will work on multiple platforms and versions of .net?
You can change your target framework in the project properties (right click the project and select Properties):
Because higher .NET versions are backwards compatible with earlier versions, you can target a lower version that what is on your machine, though it means that you lose out on the newer apis.
So, for example, if you and your colleagues decide that .NET 4.0 is a good target, then having .NET 4.5 or .NET 4.0 will work for building and running the application.
For more information on Framework Targets, see:
What does it really mean to target a framework, and how do I maximize compatibility?
What is the effect of setting a “Target framework” in Visual Studio

Can we use XBAP (WPF browser app) built using .net 3.5, on client machine having only .net 3.0

I have an XBAP application built using .net framework 3.5. It's published with full trust on a web server. I am able to use it on client machine having .net framework 3.5.
Question: can I also use this XBAP application on a client machine having only .net framework 3.0? That is no .net 3.5 on client machine.
Thanks in advance for help.
No.
.Net applications require the .Net runtime.
You cannot run a .Net 3.5 application in machine that does not have the .Net 3.5 runtime installed.

Resources