Creating ASP.NET project on Mac - visual-studio-mac

I have always been thinking that .NET framework is Windows only, and .NET Core is cross-platform (Win, Mac, Linux). And ASP.NET or ASP.NET Core is the web framework, respectively within the huge .NET or .NET Core realm. I thought the rule of thumb is that, if something does not have the "Core" suffix, it is Windows-only. However today I found I can create .NET projects using Visual Studio for Mac on my MacBook. I am really confused. Are these projects running on .NET framework (the runtime), or .NET Core? What did I miss here?

.Net Framework Guide
"The .NET Framework is a development platform for building apps for web, Windows, Windows Phone, Windows Server, and Microsoft Azure. It consists of the common language runtime (CLR) and the .NET Framework class library, which includes a broad range of functionality and support for many industry standards."
.Net Core Guide
".NET Core is an open-source, general-purpose development platform maintained by Microsoft and the .NET community on GitHub. It's cross-platform (supporting Windows, macOS, and Linux) and can be used to build device, cloud, and IoT applications."

Related

I cannot change the Target Framework from .NET 5.0 to .NET 4.8 for a C# .NET Framework Class Library in Visual Studio 2019

I am trying to build a .NET 4.8 Class Library that I can make COM-Visible as a support library from an Access application.
There are no prompts for the version of .NET Framework when I create the solution.
When I look at the Project Properties, the .NET Framework is set to 5.0.
Although I have the .NET Framework 4.8 installed, it does not appear in the combo-box for the Target framework. The only options are shown below.
I have also noticed that the Startup object combobox does not reflect the selected startup assembly.
Do I need to drop back to Visual Studio 2017 to create a .NET Framework 4.8 library?
Which SDK is installed?
If you only have the .net 5 SDK installed, it might suffice for making a .net core 3 app but it will not cover .net Framework.
Install the .net Framework SDK for the version you want to target.
And/or install a targeting pack if you want to target .net 4.8 and 4.7.2 for example.
(Maybe helpful: What's the difference between the .NET Framework SDK and the Targeting pack)
This happened to me because I had choosen the wrong kind of project.
I had choosen a project library for C#, Windows Linux, macOS.
By this the same thing, that one could only had .NET 5.0 and higher as Framework.
I had to create a new library project with only C# and Windows.
Than I could choose all installed .NET frameworks

using .NET Standard 2.1 with UWP

I made the big mistake of taking some NuGet library updates today. It forced me to either roll back a week's worth of work or upgrade to ASP .NET Core 3.0. I hate to use stuff that's not production, but I didn't want to untangle the libraries either, so I upgraded. Then it forces me to retarget .NET Standard 2.1 libraries. Which I did.
My problem now is with the client UWP code. When I try to compile, I get:
error : Project '..\ClassLibrary1\ClassLibrary1.csproj' targets 'netstandard2.1'. It cannot be referenced by a project that targets 'UAP, Version=v10.0.10586'.
This happens even with a virgin UWP and .NET Standard 2.1 library. Any clues on how to make Visual Studio 2019 client code work with the latest upgrade?
All Windows 10 SDKs currently don't support .NET Standard 2.1.
Windows 10 19H2 is using the same SDK number as 19H1, so it is unlikely that it will support .NET Standard 2.1. (But I certainly hope it does.)
Microsoft hasn't made an official announcement, but Windows 10 20H1 is getting a meaningful SDK update, so it is likely that it will support it. And once that's the case, UWP apps will require 20H1 to run (so that will become the minimum supported version).
One of the big issue with this situation is that Entity Framework Core 3.0 requires .NET Standard 2.1, so it can't be used in UWP apps for now (Update: This issue is resolved with Entity Framework Core 3.1 supporting .NET Standard 2.0).
By the way, as an experiment, I was able to fork Entity Framework Core 3.0 (for SQLite) and make it compile on .NET Standard 2.0. I basically had to manually copy a few new APIs from .NET Core 3.0 (like IAsyncXXX). And it worked, so it is an option for people who really need it. Note that, I did not try it with the SQL Server provider.
Update: The UWP team is planning to enable UWP apps to use .NET 5 and that's when UWP will support .NET Standard 2.1 (and more). This could happen in 20H2 or 21H1.
UWP does not support .Net standard 2.1 yet. It only support till .Net standard 2.0 and that too from windows 1709 onwards.
If you look at the link for 2.1 it states
Platform Support
An upcoming version Universal Windows Platform
so it may be 19H2
UPDATE
Microsoft is going to release a new framework called WinUI 3, this is going to support UWP as well as Win32 based application model. WinUI 3 would support .Net 5 for both the platforms. WinUI 3 preview is going to be available in mid May 2020, with final release in late 2020. WinUI 3 would be supported on windows 10 1803+.

.Net Core Vs .Net framework to create a new mvc web application

I have visual studio 2015 professional editton, and i want to create my first MVC web application which should be a .net core. now i am watching an online learning demo, which mentioned to create this project:-
while inside my visual studio i have these options:-
so which option i need to chose?
second question, how i can be sure that i am using the latest version of MVC?
Thanks
First, there is no such thing as MVC 6. It's ASP.NET Core. Second, the decision of whether to use .NET Core or .NET Framework comes down to what you need to do. .NET Core is cross-platform (Windows, Mac and Linux), whereas .NET Framework is Windows-only. .NET Core is also lighter weight, faster, and has a number of new CLR features, compared to .NET Framework. Virtually the only reason to use .NET Framework is if you have a dependency on something that utilizes Windows-specific APIs, meaning it can't be run cross-platform. Otherwise, you should always use .NET Core, if you can get away with it.
ASP.NET Core is really just a collection of NuGet packages, and like other NuGet packages, they can be updated easily. However, the difference is that these NuGet packages are generally tied to a particular version of .NET Core, and thus, the appropriate version of the packages are installed based on which version of .NET Core you're targeting. For example, if you're targeting netcoreapp2.2 then you'll see that that packages like Microsoft.AspNetCore.App will be brought in with versions like 2.2.x.
So, to answer your question about staying up to date, it essentially entails installing the latest version of the .NET Core SDK, and then changing your project to target that new version. Then, all the ASP.NET Core NuGet packages will naturally update accordingly.

aspnet core 1.0 full .net framework on Linux

I have a few simple questions:
a) can I use mono on linux and osx to load the full .net framework like I would on windows by adding net46 to my project.json?
b) can I use mono as an alias like net46?
c) can I use mono with aspnet core 1.0 rtm projects on linux?
I have been looking at the dotnet docs, specifically the standard library and the table and the table with the platform support confuses me with the arrows and star under mono.
thanks
can I use mono on linux and osx to load the full .net framework like I would on windows by adding net46 to my project.json?
In theory, yes, that's exactly what you do: specify some version of net inside frameworks in your project.json and dotnet run will then use mono to run your application.
In practice, basic Hello World application works, but I'm not sure how well will more complicated applications work.
If you want to run dotnet build on the same machine, you will also need reference assemblies. The version I tested (mono 4.2.1) only contained reference assemblies up to .Net 4.5.1, so net451 works, but net46 doesn't.
can I use mono as an alias like net46?
I don't think you can, at least not without forking .Net Core SDK.
I don't understand why would you want to do that, but I believe doing so would require modifying DefaultFrameworkMappings in NuGet.Client.
can I use mono with aspnet core 1.0 rtm projects on linux?
I wasn't able to make a basic ASP.NET Core application run under mono. I don't know what the problem is, or how hard would it be to fix it. EDIT: I managed to work around the issue I encountered.
Mono is other thing. Yeah they developed mono like .net framework but you cannot use .net 4.6 on mono.
Read the following article. Click here
Micrsoft developed .net core a new framework to run .net on windows, linux, mac osx etc.

my webapi mvc4 not run in server with net.4.0

hello I made one applicattion(WEB API MVC4 which connect with SQL server) using framework 4.5, in my IIS express run fine but I try publish in other server which uses framework 4.0, my applicattion not run ?
I change in properties of my application works with framework 4.0 and in my IIS express run fine but other server not run.
I can't upload version framework in the other server.
thanks for the asnwers and sorry for my english I'm learning
Maybe you have changed target framework attribute in your web application that isn't sufficient to deploy. In your codes you may use libraries that require .net 4.5 while you only have changed the setting. About running this in your iis express must say that your system by default supports .net 4.5 while your app says i need only .net 4.0. So .net 4.5 related parts will be compiled and executed on local server and no ambiguous thing is here.
Running .NET4.5 based app on .NET4 machine is not supported. Simply because .NET4.5 is a super set of .NET4. Everything that's built for .NET4 works on .NET4.5 but not the other way around. If you are using Visual Studio 2012, you can change TargetFramework (in project properties) to .NET Framework 4, this will ensure that your app is built for .NET4.
--Varun
(.NET Framework Team)

Resources