ASP.net 5 preview templates are missed in Visual Studio 2015 - c#

I have installed Visual Studio 2015 update 3 and have installed the latest Web Essentials update and also have installed DotnetCore version. But when I create a new asp.net project, only asp 4 templates like in the image are available
create form image

First of all, there is no ASP.NET 5 anymore. It has officially been renamed to ASP.NET Core 1.0.
You seem to have missed that announcement, which would have made the selections in Visual Studio more obvious. When you choose File > New Project..., you get to a dialog that gives you a choice to go with ASP.NET Web Application (.NET Framework), ASP.NET Core Web Application (.NET Core) or ASP.NET Core Web Application (.NET Framework). This is the dialog before the one you have posted a screenshot of.
NOTE: In order to see all 3 of these options, you need to choose at least .NET Framework 4.5 from the dropdown.
The last two options are for the new ASP.NET Core 1.0 framework. The first of which is to run on the .NET Core library (cross-platform) and the last which is for the .NET Framework 4.6.1 library (which is not cross-platform).
Of course, if you choose ASP.NET Web Application (.NET Framework) , you get a regular MVC 5 or Web API 2 application.

Related

VS 2017 ASP.Net Core Web Application cannot target .Net Framework

I seem to have lost the ability to create an ASP.Net Core Web Application that targets the .Net Framework. The dropdown is disabled where it used to be enabled.
I have .Net 471, 472 SDKs and targeting packs installed and my VS2017 is updated to 15.7.6.
I've tried uninstalling/reinstalling the .Net 4.7x SDKs and targeting packs but that didn't help.
Is there something short of reinstalling Visual Studio from scratch that I can do?
The project template only supports .NET Core. However, once you create the project, you can edit your .csproj and change:
<TargetFramework>netcoreapp2.1</TargetFramework>
To:
<TargetFramework>net472</TargetFramework>
Save, and you're good to go.
It would appear that there are two templates now that can create an ASP.Net Core Web Application.
Under .Net Core
And under Web
To get the option of selecting to target .Net Core or .Net Framework, you must use the template under Web.

Not able to start project as asp.net Core (Razor App)

I have installed VS 2017 community edition and i am trying to create ASp.net Core 2.0 (Razor Page) but i am not getting that template when i create the project as show in this tutorial
What i get is show in below image
I am new to .Net Core and want to start learning .Net Core.
ASP.NET Core with Razor Pages is the third option in your screenshot:
However, unless you will create extremely simple web applications, you should skip it and go to the full ASP.NET MVC (fourth option). While Razor Pages is very new (only some months old), MVC has been pretty much the same for years, and allows for much more development.

What is the difference between creating a project ASP.NET Core (.NET Core) and ASP.NET Core (.NET Framework)

I don't see clearly the main difference between the last two project types, actually which sense have the last one? .NET Core and .NET Framework?
The difference is whether you will be targeting the .Net Core Framework or the Full .Net Framework. And this difference shows up for example in the project.json file.
Another thing to know about is that when you use the "ASP.NET Core Web Application (.NET Framework)" template it's much easier to link to .Net Library Projects that target the full framework when using Visual Studio. It's possible to do it using the "ASP.NET Core Web Application (.NET Core)" template but it requires some manual editing of the project.json file.
It may also be worth mentioning that if you target the Full Framework the web application must be deployed on Windows, whereas targeting the .Net Core framework allows the web application to be deployed to non-Windows environments. But the .Net Core Framework is not as feature rich as the Full Framework. (It has no drawing routines for resizing images for instance). You can read more about choosing the right framework here: https://docs.asp.net/en/1.0.0-rc1/getting-started/choosing-the-right-dotnet.html
Either way, no matter which of these two templates you select, you will be creating a project for creating an ASP.NET Core application.
Some differences in the actual projects created
Here is what the solution looks like in Visual Studio 2015 Update 3 when "ASP.NET Core Web Application (.NET Core)" is chosen (with Empty option):
And here is its project.json file:
Here is what the solution looks like in Visual Studio 2015 Update 3 when "ASP.NET Core Web Application (.NET Framework)" is chosen (with Empty option):
And here is its project.json file:
ASP.NET Core can run on top of .NET Core or the full .NET Framework. So there's a template depending on whether you want to build on .NET Core or the full .NET Framework.
Here's an infographic that Microsoft put together that visually demonstrates the concept:
No matter which template you choose, you can always edit your configuration to target both at the same time. But the templates just help you get started with one or the other.

Unable to add controller after moving project to VS2013

I have just moved my MVC project from one machine that was running VS2012 to my new machine running VS2013. Everything works when I open/build my project on the new machine however when trying to add a controller (by right clicking on the controllers folder and clicking Add>New Controller') I get the following error:
I have tried restarting everything, cleaning the code etc. but can't find out how to fix this issue. If I manually add a new item and then select MVC Controller Class it works fine.
You did say which version of ASP.NET MVC you were using in VS 2012 but below is from the Visual Studio compatibility guidelines, which may help if you were using MVC 3.
Visual Studio 2010 SP1 supports only MVC 2 and MVC 3, Visual Studio 2012 supports only MVC 3 and MVC 4, and Visual Studio 2013 supports only MVC 4. For information about how to automatically upgrade from MVC 2 to MCV 3, see ASP.NET MVC 3 Application Upgrader. For information about how to manually upgrade from MVC 2 to MVC 3, see Upgrading an ASP.NET MVC 2 Project to ASP.NET MVC 3 Tools Update. For information about how to manually upgrade from MVC3 to MVC 4, see Upgrading an ASP.NET MVC 3 Project to ASP.NET MVC 4. If your project targets the .NET Framework 3.5 SP1, you must retarget it to use the .NET Framework 4.

How to use razor syntax in asp.net mvc 2.0

I am developing an app in asp.net mvc 2.0 in which I want to implement Bread Crumb pattern. I browsed a lot of sites for this purpose and find the solution of my problem in MVC 3.0 through mvcsitemap provider. They are using razor syntax and I am unable to use the razor syntax in MVC 2.0. Please help me.
For using Razor View Engine, you can covert your MVC 2 application to MVC 3.
It will not be possible to use Razor in MVC 2.
MVC 3 Project Upgrade Tool
MVC 3 Project Upgrade Tool
This standalone application upgrades ASP.NET MVC 2 applications to ASP.NET MVC 3. It works for both ASP.NET MVC 3 RC 2 and RTM. The tool only supports Visual Studio 2010 solutions and MVC 2 projects targeting .NET 4.
It will not work with VS 2008 solutions, MVC 1 projects, or projects targeting .NET 3.5. Those projects will first have to be upgraded using Visual Studio 2010 and/or retargeted for .NET 4.

Categories