15

I was always able to set the target framework version for regular .NET projects. In a UWP app I can only set the "Windows 10 build version".

How do they relate to the .NET (core? native?) platform versions?

Cœur
  • 37,241
  • 25
  • 195
  • 267
bas
  • 13,550
  • 20
  • 69
  • 146
  • Windows 10 _is_ your platform here. – H H Oct 03 '16 at 19:15
  • 1
    @HenkHolterman I understand that I target OS versions which can run my app. But does it compare to a version of .NET core 1.0? Is there a link between "windows 10 anniversary" and .NET core 1.0 (or .NET core 1.1)? – bas Oct 03 '16 at 19:21
  • 2
    You can refer to [the answer here](http://stackoverflow.com/questions/7416826/how-does-windows-8-runtime-winrt-windows-store-apps-windows-10-universal-ap). – Grace Feng Oct 04 '16 at 01:27

2 Answers2

11

UWP doesn't target a NET framework version, but it targets an SDK version, you can change the sdk version in project properties: enter image description here

You can also set the minimum target version.

Furthermore, since UWP .NET Project (C# or Visual basic) is based on .NET Core you can upgrade (or downgrade) the .NET Core version through .nuget: enter image description here

Stefano Balzarotti
  • 1,760
  • 1
  • 18
  • 35
  • Thx! This seems to answer the dotnet core version. Just turned off my pc though, I will check this tomorrow! – bas Oct 03 '16 at 21:03
  • 5
    The UWP SDK is **not** based on .NET Core. It is strictly a native implementation with a native programming interface. .NET Core is a dependency for modules that decided to use a managed programming language (like C#). – IInspectable Oct 03 '16 at 23:11
  • @IInspectable I think that's exactly the confusion for me and apparently I am not alone. Maybe you could drop an answer with "that one link microsoft" where the dependencies are properly explained? I can read about .NET core vs .NET, or core vs native, and any combination, but as a developer I *just* want to know which API I have, and what I can (and maybe equally important!) can*not* expect in the (near) future. I can find that information easily for .NET 4.6, I'd be more than interested to find the same info regarding UWP. – bas Oct 04 '16 at 10:47
  • @IInspectable I said a mistake, the UWP SDK is not based on .NET Core, in fact, you can use the SDK in a Native C++ Project without .NET Core. But a .NET UWP project is based on .NET Core, you cannot uninstall .NET Core from .nuget, all managed components (For example Page class) implements .NET Core. You cannot use SDK in .NET project without .NET Core, so I can say in any case that .NET Core is a dependency of SDK in a .NET project. – Stefano Balzarotti Oct 04 '16 at 17:15
  • A preview of .NET core is also used in a Windows 8.1 UWA .NET project, you can see the NETFX_CORE dependency in the .csproj file. Before windows 8.1, store applications are based on silverlight. – Stefano Balzarotti Oct 04 '16 at 17:22
  • @bas here is the link with all APIs from UWP: https://msdn.microsoft.com/en-us/library/windows/apps/bg124285.aspx . Also Microsoft insists that there is ".NET for Windows Store apps" https://msdn.microsoft.com/en-us/library/windows/apps/br230302.aspx, but you kind of insist not to accept that and search the answers only in what is "acceptable" to you. – Ivan Ičin Oct 05 '16 at 07:50
  • @IvanIčin, I think you would have had a point if you said it's hard for me to wrap my head around it and ask the perfect question. I reject the remainder of your comment. – bas Oct 05 '16 at 12:02
  • *"all managed components (For example Page class)"* - Like all other control classes, the [Page](https://msdn.microsoft.com/library/windows/apps/windows.ui.xaml.controls.page.aspx) class is **not** managed code. It's a native implementation, exposed as a COM interface, that is **projected** into C# to look like a managed type. It genuinely is not the SDK that pulls in the .NET Core dependency. (None of my C++/CX projects that use the `Page` class, for example, have a .NET Core dependency.) – IInspectable Oct 12 '16 at 21:00
  • 3
    @IInspectable In a .NET project you can't use C++ native classes directly, you need to marshall the class in another .NET class. So when you use Page class , or any other class in .NET, you use a managed class that implements System.Object. Who cares if is based on a native implementation or not, you always use a .NET managed interface. Since the .NET Page class (wrapper of native implementation) inherits from System.Object as all .NET classes and System.Object is defined in .NET Core (for UWP projects) I can say: Page class in .NET UWP Project has a dependency with .NET Core. – Stefano Balzarotti Oct 12 '16 at 21:19
  • 2
    Also, I understand that you want give a precise explanation, but the question is clearly related to .NET context. Probably I should have explained better, but no one is arguing that a native UWP SDK depends from .NET Core. – Stefano Balzarotti Oct 12 '16 at 21:27
  • 1
    *"Page class in .NET UWP Project has a dependency with .NET Core."* - That's inaccurate. It's the language **projection** that creates the .NET Core dependency, not the `Page` class (or any other UWP type) itself. The SDK is really just native code plus .winmd metadata. – IInspectable Oct 12 '16 at 21:28
  • 1
    @iinspectable, I think UWP has dependency on corefx (base class libraries) part of .net core but it doesn't use the CoreCLR (runtime) part of it in release mode. That runtime is truly a native c++ runtime. – nawfal Jan 14 '18 at 01:31
2

UWP is a set of APIs (just like any .NET). There are different APIs available depending on the API contract, which is connected to the official builds of Windows releases. Those numbers aren't the same - currently Microsoft marked each Windows 10 official update as a new major version of API contract, so latest added APIs are marked with 3.0.

Ivan Ičin
  • 9,672
  • 5
  • 36
  • 57
  • OK, but is there a relation to a specific release of a .NET platform version? Does it relate to .NET core? .NET native? And if so, how can I say which framework version(s) I can address from my UWP app? – bas Oct 03 '16 at 19:58
  • @bas UWP IS framework. It might respect some .NET core version (but it is surely NOT .NET Core), but it has nothing with desktop .NET framework. They are completely separate entities. – Ivan Ičin Oct 03 '16 at 20:02
  • .NET Core is a dependency of UWP Framework, and can be managed through .nuget – Stefano Balzarotti Oct 03 '16 at 20:57
  • 3
    @StefanoBalzarotti: No, it isn't. .NET Core is not at all required to target the UWP. It's (more or less) a needless dependency, if you decide to use a .NET programming language (for whatever reason). UWP is a native programming interface, based on COM. – IInspectable Oct 04 '16 at 10:12
  • @IInspectable I'm very confused. Been reading a lot over the past week, and still don't know much. My understanding was that UWP = .NET Core + WinRT libraries. This interview (https://developer.telerik.com/topics/net/universal-windows-platform-uwp/) says "The runtime is WinRT and powered by .NET Core" However MS document (https://github.com/dotnet/standard/blob/master/docs/versions.md) certainly shows .NET Core and UWP as distinct flavors of .NET Standard. At the end of the day, for UWP development, I can use a large portion of .NET technology I'm familiar with, without worry I guess? – christopherdrum Aug 21 '17 at 06:54
  • 3
    @christopherdrum: UWP is a **native** wrapper around the Windows API. There is no .NET in UWP whatsoever. Now you **can** use .NET programming languages, if you are fine to pull in a .NET Core dependency. This may or may not be a problem. If you are developing re-usable components, you may want to keep a low dependency profile, and use native programming languages (C, C++, C++ with WRL, C++/CX, or C++/WinRT) only. If you want to use a .NET programming language make sure you understand, that .NET Core is missing some .NET Standard features. – IInspectable Aug 24 '17 at 20:28