Can UWP run in .NET? - c#

When I create new UWP project it automatically references .NET Core. Is it possible to run it on .NET? Why it needs .NET Core? I can't find any valuable information about this...

It needs .NET Core because it is built on .NET Core, much like WPF is built on the .NET framework.
So no, you cannot change it to run on the standard .NET framework any more than you can make WPF run on .NET Core.

The .NET Core Framework is a new version of .NET for modern device and cloud workloads. It’s a general-purpose and modular implementation of the Microsoft .NET Framework that can be ported and used in many different environments for a variety of workloads.
and No, you cannot run UWP project on .Net
althousg if you install previous version of VS then you can run it on .NET

Related

adding a web app project to my solution, and the other projects in the solution already use .net framework, can I use .net core for the new project?

Ive build out a service as a console application, it exists across 2 different projects in the solution, both are in .NET framework. I am wanting to add in an api level to this and am wondering if I should continue to use .NET framework for the web application project, or if I can use .NET Core without messing anything up.
It all depends on the APIs you use in your application. If you only use APIs included in .NET Standard then no problem to use them in an application under .NET 6. Otherwise I join Kirk Woll to migrate your code under .NET 6 especially since the unification of the platform. I think it will remain only .NET 6 aka .NET core in the future.

Will .Net MAUI be comptabile with .NET Standard 2.0?

We currently just started to write class libraries in .NET Standard so we can use this for WPF, Winforms and .Net Core with Ubuntu Server (but then without GUI). .Net 5 does not support Winforms or WPF for our .NET 4.6.x applications.
My question is, will .NET MAUI be compatible with .NET Standard 2.0 class libraries?
When I look at the .NET Standard website its says compatibility with .NET 6.0, but I can't find if that also the .NET MAUI framework.
https://dotnet.microsoft.com/platform/dotnet-standard#versions
My question is, will .NET MAUI be compatible with .NET Standard 2.0 class libraries?
Yes, because, as it was mentioned in comments, .NET MAUI is just a library. You don't compile with MAUI, but rather with .NET 6.
All .NET Core versions starting from 2.0 can reference .NET Standard 2.0 libraries, and since .NET 6 is just a rename of what would be .NET Core 5, that is certainly possible.
The problem, however, is here:
We currently just started to write class libraries in .NET Standard so we can use this for WPF, Winforms and .Net Core with Ubuntu Server. .Net 5 does not support Winforms or WPF.
You can't use WPF nor Winforms in Linux/MacOS. You also can't use .NET MAUI in Linux as there is (currently) no target for that environment. The desktop environments supported are the same as for Xamarin: Windows and MacOS.
Notice that it was mentioned here that support for Linux is being considered for .NET 7, which should be released in around a year.

Xamarin with .Net Framework

I have started to learn Xamarin. From what I read, .Net Standard allows a developer to use code from another .Net platform into Xamarin.
The examples that I read only talk about MVC or .Net Core. The documentation says that the developer can use .Net Standard with .Net Framework 4.6.1. Visual Studio 2019 has the option to include an Asp.Net Core Web API Project as part of a mobile backend.
Is there there a .Net Framework option available?
I have a lot of .Net Framework Pages that I would like to include into Xamarin.
Do I need to rewrite all the code or is there a conversion process I need to do?
.NET Standard defines the common subset of libraries and features that are shared by both .NET Core and .NET Framework. If your existing code is using .NET Framework, it's possible that most or all of the framework features that the code relies on are supported by .NET Standard. If so, it will be easy to port the code to a .NET Standard assembly, which can be used by Xamarin. The difficulty of the port will depend on how many .NET Framework-specific features you're using.
Microsoft provides a tool to analyze how compatible your code is, you can find details here

.net core app target .net framework 4.5.2 on Linux

I wanted to understand the dot net core support a bit more.
My basic understanding was that if I wanted to run a .net app on Linux then it needs to be built .net core and targeted netcoreapp1.0 framework to guarantee this.
1) I assume the above assumption is correct?
2) When I was reading various articles online, such as this one about referencing exiting .net framework project within a .net core application (https://www.hanselman.com/blog/HowToReferenceAnExistingNETFrameworkProjectInAnASPNETCore10WebApp.aspx)
If I did this, presumably the app would only run on Windows and not Linux?
3) In the following article:
https://blogs.msdn.microsoft.com/cesardelatorre/2016/06/28/running-net-core-apps-on-multiple-frameworks-and-what-the-target-framework-monikers-tfms-are-about/
In context to running with .net run 4.5.2 option (
dotnet run -f NET452), it's mentioned:
If this app were running on the .NET Core Platform, let’s say on a Linux box or a Mac, this code won’t be executed, but the app would
still be running on Linux or MacOS.
What's the distinction between running and not executing? If my initial understanding was correct, then by running with .net 4.5.2 option on Linux I wouldn't expect the app not to run at all.
Appreciate a few questions there but really wanted to understand .net core a bit more.
There is a difference between .NET Core and ASP.NET Core and the articles you mentioned are about running ASP.NET Core "apps" on .NET Framework. Let my try to clarify this using a few declarative statements:
.NET Core is the cross-platform runtime.
ASP.NET Core is a set of libraries that until version 1.1.* can run
on both .NET Framework and .NET Core.
This means you can create a .NET Framework application (=> e.g.
net452) and use ASP.NET Corein this application.
The CLI tooling works for both projects targeting netcoreapp* and
net* - but net* currently only works on windows.
This means that for netcoreapp1.*, you cannot reference arbitrary libraries that have been built for .NET Framework. If you change the target framework to say net452, you are no longer building a .net core application, but a .net framework application.
For ASP.NET Core 2.0 this is going to change. Again a few statements:
ASP.NET Core 2.0 is still a set of libraries but they can only be used on .NET Core 2.0 and not on .NET Framework
Do note that this is still under discussion at the time of writing: https://github.com/aspnet/Home/issues/2022
.NET Core 2.0 is able to freely reference libraries that have been built for .NET Framework up to version 4.6.1
However, some libraries may fail at run time if they try to use API methods that aren't available on .NET Core

Can I use any old arbitrary WIndows library in a .net core web app?

I just can't understand why I can't use an old library in a .net Core app targeting Windows and the full .net framework (I don't care about multi-platform).
Just trying to understand the limits here. I don't want to hit a wall after investing too much into it.
Steps followed:
Create a new .Net core web Application
Added PetaPoco from NuGet (just an example)
Can't use the library
From a comment from you on a deleted answer to this question
It's not about this particular reference. I just want to understand why I can't use an arbitrary Windows DLL. (I don't care about multi-platform) – Eduardo Molteni
It appears you are not too concerned why this specific project is not working (the deleted answer you commented on covered that quite well and if it was not deleted I would have up-voted it) but why in general you can't use a .NET Framework DLL in a .NET Core project.
Here is a diagram showing the layout of the ".NET ecosystem"
Things built for .NET Framework can't use DLLs built specifically for .NET Core, and things built for .NET Core can't use DLLs built specifically for .NET Framework because they are two "siblings" in the hierarchy.
Both .NET Framework and .NET Core can use .NET Standard libraries in their projects because .NET Standard is the "parent" of both the framework and core. Many newer NuGet packages now release versions that target .NET Standard so the library can be used with both versions. See the below chart to see what version of the .NET Standard library is compatible with various platforms. netstandard libraries are forward compatible so something that is compatible with 1.5 (like .NET 4.6.2) is also compatible with versions 1.0-1.4

Categories