Blake Rivell Blake Rivell - 3 months ago 27
ASP.NET (C#) Question

Difference between using the ASP.NET Core Web Application (.NET Core) with net461 set as the only framework and using the (.NET Framework) template

With the release of .NET Core RC2 Microsoft made it so there are now 3 Web Application templates:

ASP.NET Web Application (.NET Framework) - The old

ASP.NET Core Web Application (.NET Framework) - the new, to be hosting on Windows only

ASP.NET Core Web Application (.NET Core) - Linux, OSX, Windows

I am trying to use the new Core Web Application template but without trying to target Linux, OSX, Windows so it seems like the ASP.NET Core Web Application (.NET Framework) is perfect for me. It took me a while but I learned that in order to add a class library that will work with this project type you need to add a Class Library (.NET Core) and change the frameworks section to only be net461 to match the Web Application.

"frameworks": {
"net461": { }
}


My Question:

What is the difference between creating a ASP.NET Core Web Application (.NET Core) and in project.json making net461 the only target framework

and

just creating a ASP.NET Core Web Application (.NET Framework) project which only includes net461 by default.

Are there other difference that I am not aware of like the way the the projects are published, etc...?

Answer

What is the difference between creating a ASP.NET Core Web Application (.NET Core) and in project.json making.NET461 the only target Framework

It's the same thing as making an ASP.NET Core Web Application (.NET Framework) project. The type of project between the two is determined by the project.json and you changed it in your project.json from targeting .NET Core to targeting the .NET Framework. In previous release/beta versions of ASP.NET Core it was possible to have both Frameworks in project.json but you could only publish to one. Not sure if this is still possible.

just creating a ASP.NET Core Web Application (.NET Framework) project which only includes.NET461 by default.

Are there other difference that I am not aware of like the way the the projects are published, etc If you target the .NET Framework and not .NET Core your app cannot be cross platform and your app can only run on Windows and not Linux/Mac.

The reason for there being separate ASP.NET Core Web Application (.NET Core) and ASP.NET Core Web Application (.NET Framework) is because the latter allows you to make use of functions, packages or 3rd party libraries that are dependent on Windows and the same .NET Framework or higher will be required to be installed on the machine.

The former doesn't have the .NET Framework requirement but allows your app to be cross platform and when you publish your app it publishes all the dependent .NET Core dll files to the publish directory in that way circumventing the .NET Framework installation requirement.

It will also affect compilation as if you target .NET Core and make use of a Windows specific function or package you will get a compilation error.

You can easily switch between the two by adjusting your project.json to target the one or the other.