Targeting .NET Core vs .NET Standard - c#

We've a server side "classic" WCF .NET application running on Windows. We added last year Linux support using Mono and a Web-Api replacement of WCF.
Checking the compatibility with the Api-Port tool, we found that the we would need much few changes targeting directly .NET Core instead of .NET Standard.
So for server side application like ours, that will be running only on Windows and Linux, is it correct to say that does not make any sense to target .NET Standard?

For server-side applications targeting .NET Core is enough.
There is a detailed answer here: What is the difference between .NET Core and .NET Standard Class Library project types?

Related

Can I use a net core library in a wpf application?

I am trying to develop a very simple WCF application. The WCF server will be in a windows 10 computer and I would like to consume this service with a WPF application in a windows 10 computer and also I would like to have another application for android, using Xamarin.
In visual studio I see that I can create a Net Core library and also I see that Net core is compatible with WCF, I can see in this web.
Also I know that Net Core can be run in Windows, Linux and Mac.
So I am wondering if I could develop a Net core Library to develop the client so I could use it in my WPF and Android applications.
My doubt it is when I add a reference in my WPF application to the net Core library project, I see a yellow triangle, a warning, so I guess that WPF can't use the Net Core library.
So I was thinking that perhaps, for the WCF layer, I would have to create a Net Standard project that can be use by the WPF application and the Android application. But I would like to know if this is the unique way or there are some way that a WPF application can use a Net Core library without needed to use a middle project like Net Standard.
For the server, I was thinking to use Net Core too, because this project will not be referenced by any other project and Net Core can be used in windows.
Well, you should create a .Net Standard Class Library (So, not .Net Core), put in your WCF clientside code in there and you can reference it from a .Net Core or .Net Full project. a .Net Standard Class Library will give you most flexibility so it is the recommended project type for shared libraries.
But according to the docs, see last line you will need to use .Net Full for the server side:
WCF service applications should still be created with the full .NET Framework version.
But I would like to know if this is the unique way or there are some way that a WPF application can use a Net Core library without needed to use a middle project like Net Standard.
No. A WPF application targeting .NET Framework cannot reference a .NET Core project.
.NET Core 3, which is currently in preview, does however support WPF which means that you can reference a .NET Core project from a WPF application that targets .NET Core. But an application targeting .NET Framework cannot reference a library that targets .NET Core and vice versa.
You should prefer to target .NET Standard in your class library projects since these can then be consumed from applications targeting either .NET Framework or .NET Core.
WPF / Winforms applications are not supported on .Net Core platform yet.
Present:
By yet, I mean .Net core 2.x versions.
So, if your application is NOT based on 2.x standard of .net core, you will NOT be able to reference the .net core assembly.
Future:
.Net core 3 preview is available and Winforms / WPF applications are now available on the .Net core platform.
Hope this helps.

dependency assemblies, check compatibility

I am converting a project from .net framework to .net core 2.
I need to check if my dependencies are compatible with .net core 2.
how do I check if https://www.nuget.org/packages/Aspose.Cells/7.6.0 supports .net core 2 or .net standard or .net framework?
Thanks
Please check in their link
Platform Independence
You can use Aspose.Cells for .NET to build any type of a 32-bit or
64-bit .NET application including ASP.NET, WCF, WinForms, UWP, .NET
Standard, .NET Core etc. It is possible to use Aspose.Cells for .NET
via COM Interop from ASP, Perl, PHP and Python. You can also use
Aspose.Cells for .NET to build applications with Mono.
Updated
On 2018 they have updated their Feature overview page indicating they support .net core, so probably must have supported after 18.0 version.
You can ask them by using their customer support forum

Is ASP.NET Core 2.0 the technology which is implemented in both frameworks (.Net Framework and .NET Core)?

I want to create an ASP.NET Core MVC 2 web application which I could host on Linux and Windows (i.e. in both OS). So, I am to use .Net Core. But when I create new ASP.NET Core MVC 2 web application I see two comboboxes. At first I am to select either .NET Frmework or .NET Core. The second combobox contains only ASP.NET Core 2.0.
Q1:
Does it mean that ASP.NET Core 2.0 is technology which is implemented in both frameworks (.Net Framework and .NET Core)?
It is impossible to switch .Net Framework to .NET Core for such project later. I could use .NET Core but here Microsoft writes that I am to use .NET Framework if I want to use Windows Service...
I want to use Nginx for Windows on my computer (instead of IIS) - it is interesting for me to try it. :) Here Microsoft describes how to host ASP.NET Core web application on Linux with NGinx. At the article the Create the service file topic exists. But it is for Linux... So, if I want to host my ASP.NET Core MVC 2 web application on Nginx in Windows then I am forced to use Windows Services (look here). But in the Host an ASP.NET Core app in a Windows Service article Microsoft writes that I am to use .NET Framework instead of .NET Core...
Q2
Does it mean that I can't the same project use for build my web application for Linux and Windows (for Windows Service)? Does it mean that for my goal I am to create two project: for .NET Framework and for .NET Core and to share the code sources for both projects?
Q1
Does it mean that ASP.NET Core 2.0 is technology which is implemented
in both frameworks (.Net Framework and .NET Core)?
.NET Core 2.0 and .NET Framework 4.6.1 are both implementations of .NET Standard 2.0. What this means is that they can both do the same things, and work mostly the same, but .NET Framework contains some Windows only libraries (System libraries such as Windows Forms) that mean it can only run on Windows. .Net Core programs can run on Windows, Linux and MacOS.
It is impossible to switch .Net Framework to .NET Core for such
project later. I could use .NET Core but here Microsoft writes that I
am to use .NET Framework if I want to use Windows Service...
While this is technically possible, you really want to avoid it. It's a huge headache, and usually breaks a lot of your code, with missing dependancies etc.
I want to use Nginx for Windows on my computer (instead of IIS) - it
is interesting for me to try it. :) Here Microsoft describes how to
host ASP.NET Core web application on Linux with NGinx. At the article
the Create the service file topic exists. But it is for Linux... So,
if I want to host my ASP.NET Core MVC 2 web application on Nginx in
Windows then I am forced to use Windows Services (look here). But in
the Host an ASP.NET Core app in a Windows Service article Microsoft
writes that I am to use .NET Framework instead of .NET Core...
I haven't personally used NGinx for Windows, but it looks as though they want you to set the target version for your NET Core app to NET Framework for the purposes of their example. Since .NET Core doesn't have the references to System specific libraries, you can easily change target to NET Framework. This doesn't make it a NET Framework project, it just changes the runtime against which Visual Studio will build it.
Q2
Does it mean that I can't the same project use for build my web
application for Linux and Windows (for Windows Service)? Does it mean
that for my goal I am to create two project: for .NET Framework and
for .NET Core and to share the code sources for both projects?
You can absolutely use the same application for both platforms, however it'll be a little different to how you're used to it. Since .NET Core is platform agnostic, Visual Studio won't generate an exe for you, it'll just generate dll files. You then use the dotnet command at the command line to start the program, e.g.
dotnet helloWorld.dll
This is how you run the program on any OS, provided you have the .NET Core runtime installed (There are plenty of guides on how to do this online).
Hope I've answered everything clearly :)

Deploying a .net 4.0 application

I have an application built with .net 4.0 and uses WPF
My users have Windows 7 with default .net 3.5 installed.
My application cannot be downgraded to .net 3.5 and I want to avoid users from going through the process of downloading and installing .net 4.0 which is about 40MB (Even with silent install).
Since my application is a small one, is there a way to deploy it with only the required .net 4.0 libraries? and thus avoiding the installation of the entire .net 4.0 framework
If this is not possible, is there a way to execute the .net 4.0 app in a .net 3.5 environment?
If this is not possible, is there a way to execute the .net 4.0 app in a .net 3.5 environment?
No. Basically you really need to get the environments aligned. You say your application cannot be downgraded to .NET 3.5 - presumably that's because you're using something which is specific to .NET 4.0. It stands to reason that you can't then execute that in an environment which doesn't have .NET 4.0.
You need to decide which is more painful - changing your app to target .NET 3.5, or asking your users to install .NET 4.0.

Can I use .NET 4.0 API calls on .NET 2.0?

If I make .NET 4.0 API calls and the customer only has .NET 2.0 installed, will my EXE work? I assume no -- absolutely not. But I want to reconfirm and point this out to my client yes/no.
Background... I'm from the Linux/PHP world. My client uses a Windows C# app on the frontend, and Linux/PHP on the backend. He's asked me to investigate this issue.
The .NET 2.0 runtime will error out on you when trying to run anything written and compiled with .NET 4.0, the reverse is not true.
Application code targeted against the .NET 4.0 framework will not run in an environment that only has the .NET 2.0 framework installed.
See "Version Compatibility" section here:
http://msdn.microsoft.com/en-us/library/8477k21c.aspx
What you can do is have your .NET 2 code access the .NET 4 libraries via a web service. If you were to expose the .NET 4 API via a web service, it would be agnostic of the .NET version and the technology between them all together.

Categories

Resources