Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to use Visual Studio ASP.Net 5 template with ASP.Net 4.6?

I really like the way the new VS 2015 ASP.Net 5 templates set up the client side build system. It keeps client-side build system components out of the working folders by publishing only the final assets to the working wwwroot folder.

I have to create a new project using ASP.Net 4.6 but would like to setup the same build system for node dependencies and bower/gulp components.

Is it possible to convert the ASP.Net 5 empty project to use ASP.Net 4.6 in the same separated way?

like image 267
Brad Bamford Avatar asked Nov 21 '15 15:11

Brad Bamford


People also ask

What is the difference between .NET Core 3.1 and .NET 5?

NET 5 is a free, cross-platform, open-source developer platform for building many different types of applications. . NET 5 is the next major release after . Net Core 3.1 which was released in June 2016. The word 'Core' is dropped from the name to emphasize that .

How do I know which template is used in Visual Studio project?

For example, you can right-click the project > click properties > select Application and see(refer to) the related information, for example, Output type -- Windows Application, Console Application, Class Library… Or you can find some related information about the project type from items, files etc.

Is .NET Framework .NET 5?

NET Framework. ASP.NET Core 5.0 is based on . NET 5.0 but retains the name "Core" to avoid confusing it with ASP.NET MVC 5. Likewise, Entity Framework Core 5.0 retains the name "Core" to avoid confusing it with Entity Framework 5 and 6.


1 Answers

Is it possible to convert the ASP.Net 5 empty project to use ASP.Net 4.6 in the same separated way?

The short answer is "yes", it is possible.

While there are differing versions that have various templates, you could technically achieve what you're looking for by creating your own template.

Visit either of the two MSDN references below for a step-by-step on creating custom template(s):

  • https://msdn.microsoft.com/en-us/library/ms247121.aspx
  • https://msdn.microsoft.com/en-us/library/tsyyf0yh.aspx

The slightly longer answer "yes, but with some noteworthy caveats".

From within Visual Studio 2015 navigate File > New Project > Installed > Templates > Visual C# > Web > ASP.NET Web Application, then select from the ASP.NET 5 Templates "Web Application".

New ASP.NET Project - Web Application

Open the project.json file and change the frameworks from this:

  "frameworks": {
    "dnx451": { },
    "dnxcore50": { }
  },

To this:

  "frameworks": {
    "net46": { }
  },

Now you have the desired template that is targeting the .NET 4.6 runtime environment. One major note and disclaimer is that even though you're targeting .NET 4.6 this is not ASP.NET 4.6, in fact it is still a DNX project and uses the latest ASP.NET Core 1.0 libraries, it just so happens that you're instructing it to run on-top of a known .NET 4.6 runtime.

ASP.NET Core 1.0 (formally known as ASP.NET 5), is a complete re-write and is still currently only in RC1 as of 3/09/2016. With that said, there is much more IDE support and tooling yet to come with RC2 and the final version. It should be understood that ASP.NET Core 1.0 is not ASP.NET 4.6.

like image 186
David Pine Avatar answered Sep 30 '22 18:09

David Pine