Visual Studio 2019 .net standard with linux platform - visual-studio

How come visual studio allow me to create a new .net standard project on Linux platform?
Isn't Linux is only in .net core?
Thanks

It seems to be some confusion about the differences between .NET Core and .NET Standard. It's true that only .NET Core runs on Linux (and not the normal .NET Framework), but .NET Standard means a different thing.
It only dictates the base standard library for any .NET implementation, not a specific one. As .NET Core complies with .NET Standard, this is the runtime that'll run your code on Linux, and that's because the option appears there.
In more programmers words, consider .NET Standard an interface, while .NET Core being the concrete implementation for it. The interface knows nothing about the implementation, hence it's platform-agnostic.

Related

How do I convert a project from targeting .net core to target framework to a .net standard?

I created a new .net core 3.1 project and built it using VS2019 16.4.4
Now I want to change it to .Net Standard.
I know to go to the project properties and select the Target framework combo.
However no Standard framework options appear.
If I select Install other frameworks then I am taken to The download .Net SDKs for Visual Studio page
However the SDK I want is already installed on my machine.
Why am I not seeing what I want in the combo box.?
.NET Standard, like .NET Core and .NET Framework, is separate framework, so you can't switch that easily. You would need to create separate project targeting .NET Standard. Once you do it, you will see other options in 'Target framework'.
Worth to mention, you can't reference .NET Core and .NET Framework projects from your .NET Standard library, since .NET Standard is just an abstraction which is built differently depending on the executing environment (.NET Core or Framework)

Xamarin cross platform .net2.0

I've created a Cross platform Application for Xamarin in Visual Studio. The application is running on .NET Standard 2.0 and it's not possible to select a higher version.
Isn't possible to run a Xamarin project on a newer .NET version? The problem is that a want to install nuget packages that requires at least .NET 4.5.
Thanks in advance.
You are confusing .net and .net standard. .net standard gathers many other .net platform (for example .net core, uwp, windows phone etc...) including the classical .net (from 4.5 to 4.6.1). Take a look at this table to have a better understanding.
This means that you should be able to include your library that targets .net 4.5.
Now that you know that, you can define a fallback version if the library does not target .net standard. To do so add this line in your .net standard .csproj in the PropertyGroup node
<PackageTargetFallback>$(PackageTargetFallback);portable-win+net45+wp8+win81+wpa8</PackageTargetFallback>
.NET Standard is a standard, official documentation is nicely covering it. Beside that must read, here is a compatibility table.
So please, read the official documentation. Setup your mind and come back with a proper question. Currently it does not make sense.
Good luck!
P.S.: Currently you are trying to use an outdated library that does not support .NET Standard, you might want to look for alternatives.

Class Library (Legacy Portable)?

I have one PC with Microsoft Visual Studio Community 2017
Version 15.2 and it has a project template for Class Library (Portable).
Another PC with Version 15.3.1 has a template for Class Library (Legacy Portable). Are PCLs now legacy ?
Any current news on what I should be using instead ?
Well, "should", I won't say that without seeing exactly what you're doing but yes, PCLs are now "legacy", the new way is .NET Standard and .NET Core.
Please note that legacy does not mean "will stop working" so there shouldn't be a need to do anything as of yet.
To figure out which kind of .NET Standard version you want to target to get-out-of-legacy, you can consult the compatibility list on the .NET Standard web page.
Specifically, you likely want to consult the other matrix on the same web page, the .NET Implementation Support matrix and figure out which platforms you want to target, then create a "Class Library (.NET Standard)" project targetting the highest .NET Standard version you can get away with.

Nemerle for Windows Phone

I just started to study Nemerle. Since this is .NET language, I wonder, is possible to use for Windows Phone development? Does Visual Studio support it well?
Nemerle compiler uses System.Reflection.Emit for assembly manipulations. Then it can create assemblies same CLR version only.
I know only one reciepe for build WP assemblies: ildasm ncc.exe, fix all references to WP framework and ilasm it again.
This may not be possible, since Windows Phone runs a subset of the full .NET Framework which is closer to the .NET Compact Framework.
Looking at this page (translated from Russian) it looks like Compact Framework support is something that is/was planned for Nemerle version 2. However that article was written before Jetbrains acquired the project, so objectives may have changed.
Having said that, much more recently (Feb 2013) one of the Nemerle developers spoke about their difficulties in getting Nemerle to support other frameworks. So perhaps it is on their agenda after all.

Bundle .NET 3.5 libs with app, so it runs on machines with only .NET 2.0 installed?

I want to use LINQ on machines with only .NET Framework 2.0 installed.
I've alread read about LINQBridge. But can't I simply set "copy local" to the referenced assemblies like System.Core.dll and System.Xml.Linq.dll to get the functionality I need?
Are there any drawbacks? Is this even allowed?
.Net 3.5 is really just .Net 2.0 with some extra dlls. There is no 3.5 runtime. If you include the dlls you need, the application will run without any problems.
From the following article concerning the linq bridge comment: http://www.albahari.com/nutshell/linqbridge.aspx
First, it's important to understand
that C# 3.0 and Framework 3.5 are
designed to work with CLR 2.0—the same
CLR version that Framework 2.0 uses.
This means that the C# 3.0 compiler
emits IL code that runs on the same
virtual machine as before.
This makes Framework 3.5 additive—just
as Framework 3.0 was
additive—comprising additional
assemblies that enhance the existing
2.0 Framework and CLR. So there's nothing to stop us from writing our
own assemblies that do the work of
Framework 3.5 (at least, the critical
bits required for local LINQ queries).
The compiler then looks for Where,
OrderBy and Select methods. The
critical thing is that it can find
appropriately named methods with the
correct signatures (typically
extension methods). But it doesn't
matter what assembly the methods come
from. LINQBridge simply provides
another source of these methods—that
are functionally identically to those
implemented in the Framework 3.5
assemblies.

Resources