Create MVC 4 application - asp.net

I asked a question earlier about Changing MVC 5 and .NET target framwork because the application I have will not work with Windows Server 2003 (they didn't tell me that). If you know a way to do this, so I can avoid what I'm about to ask, please let me know.
Anyways, I'm trying to create a MVC 4 web application using the newest from of Visual Studio 2013. In a new application I already changed the framework to .NET 4 but I only find MVC 5 listed when I try to create a new controller.
I'm not really sure what I need to do, if I need to download a later version of Visual Studio or find a certain template.
Also, I learned how to create my web application using this tutorial, so maybe that will give you a better idea where I'm coming from, AKA I'm new at this stuff.
http://www.asp.net/mvc/overview/getting-started/database-first-development/creating-the-web-application

You will find the MVC 4 Application (Based on ASP.Net 4, not 4.5) In the Visual Studio 2012 project types. File -> New Project, Expand the Web node, Visual Studio 2012. The Asp.net MVC 4 Web Application project template will create the correct controller templates. It is not sufficient to create a standard MVC Application (which will be MVC 5) and then change the target framework.
Bear in mind, some examples you may find for MVC may not function exactly as advertised using the older framework type.

Related

Asp.net 5 mvc 6 Entity Framework 7 database first

I noticed that this type of project does not support files edmx.
What is the right way to develop a project in Asp.net 5 MVC 6 using Entity Framwork 7?
Currently(as of EF 7, RC1) Database First support is still in development. More info on roadmap page here and on EF Design meeting notes here.
Since this is in development there are ways to try this and more info and tutorial on commands can be found at official documentation page here.
The problem is that EF7 kill EDMX. You now have Code First-style POCOs tied to an existing database, without an EDMX file in sight. The EF Power Tools Visual Studio extension can be installed to generate all of this directly from existing database.EF Power Tools Visual Studio extension actually doesn't support vs 2015

HelpPage for ASP.NET vNext MVC 6 Web Api

I am currently checking out asp.net vnext MVC6 in Visual Studio 2015 Preview. I'm pretty new to asp.net in general, but within my company we are going to move towards creating a web api using asp.net for accessing data on our server (currently we only support wcf communication with our own silverlight application). This is the reason I am checking out the new functionalities of MVC 6 to judge whether we should wait before starting our development and use MVC 6 when it is finally released or start development now and create a Web API 2 project.
Anyway, I am looking into auto documenting the web api, which is already integrated into the Visual Studio template for a WebApi 2 project by use of Microsoft.AspNet.WebApi.HelpPage.
Now for my question, is something like this available for MVC 6 aswell? I can import the same package in my project.json in my ASP.NET vNext / MVC6 (whatever you want to call it) project but i can't do app.UseHelpPage(); in my Startup.cs file.
I suspect this is not (yet) integrated in the current release yet. If not, is there anything known about integration of this feature once ASP.NET vNext eventually hits the shelves?
Probably this feature is not available in MVC 6 yet, but you could try Swagger.
Swagger basically is a framework for describing, consuming, and visualizing RESTful APIs.
The nice thing about Swashbuckle that it has no dependency on ASP.NET MVC, so there is no need to include any MVC Nuget packages in order to enable API documentation, as well Swashbuckle contains an embedded version of swagger-ui which will automatically serve up once Swashbuckle is installed.
Source: http://bitoftech.net/2014/08/25/asp-net-web-api-documentation-using-swagger/

Webforms application .NET 4 in Visual 2013

I have a quick question concerning creating an web forms application with visual 2013 express. I'm working on older servers (Windows 2003) which cannot handle anything greater than .NET 4.
When I go to create my application with visual studio 2013 I go to the Visual Studio 2012 tab, where MVC 4 is listed and choose the web forms application there. What I've learned though, is that it automatically sets the framework to 4.5 still, so I have to change it to 4. In doing so, the NuGet packages get messed up and I have to reinstall them all. I discovered after reinstalling them all it's still messed up and I'm getting build errors. I assumed because I choose to use an older version of webforms, it would automatically set my framework up for me as well. Doing a little troubleshooting I discovered that even when you choose to create a MVC 4 application it still sets the framework to 4.5 and messes everything up when you try to change it.
I'm thinking about just downloading an older version of visual but I don't have admin rights to my computer and that is a pain. Any insight?
I'm painfully new to this material, so everything in layman's terms is appreciated!
when you select MVC 4 Web Application, or any of the other templates, there is a drop down at the top that allows you to select which Framework you would like to use. I'm using professional, it may be different in express.
http://msdn.microsoft.com/en-us/library/bb398202.aspx

What is ASP.NET vNext?

Can anybody tell me what is ASP.NET vNext?
Every new version on .Net is something like .NET 1.0, .NET 2.0, .NET 3.0, .NET 3.5, .NET 4.0 then why this version is not something like ASP.NET 6.0?
vNext is just the name given to product in the pre-release mode, like c# vNext which will apparently be released as C# 6.0, maybe ASP.NET vNext will have a numbering when it releases.
What is ASP.NET vNext?
Microsoft ASP.NET vNext is a smaller and efficient framework as a result of rebuilding the libraries from ground up.
What's new in vNext
Cloud-optimized versions of MVC, Web API, Web Pages, SignalR, and Entity Framework.
MVC, Web API, and Web Pages will be merged into one framework, called MVC 6.
MVC 6 has no dependency on System.Web. The result is a leaner framework, with faster startup time and lower memory consumption.
vNext is host agnostic. You can host your app in IIS, or self-host in a custom process.
Dependency injection is built into the framework. Use your preferred IoC container to register dependencies.
vNext uses the Roslyn compiler to compile code dynamically. You will be able to edit a code file, refresh the browser, and see the changes without rebuilding the project.
vNext is open source and cross platform.
More information:
Overview on asp.net
Getting started with ASP.NET vNext
Blogpost by Scott Hanselman
Blogpost by David Fowler
Contributing to ASP.NET vNext
Sample ASP.NET vNext applications
ASP.NET vNext is the next version of ASP.NET, but it hasn't shipped yet, so it is not an official version. "vNext" is just a working title.
ASP.NET vNext was the code-name for the next generation of ASP.NET, whose official name is ASP.NET 5. As of now ASP.NET 5 is not yet finished and documentation about can be found at http://asp.net/vnext.
ASP.NET 5 is not just an evolution of the previous version(s), it is rebuilt from the ground. Existing ASP.NET applications will run on ASP.NET 5 without modifications, but to take advantage of the new features, such applications will have to be ported to the new version.
Here's a little excerpt of what http://asp.net has to say about ASP.NET 5:
ASP.NET 5 is a lean .NET stack for building modern web apps. We built it from the ground up to provide an optimized development framework for apps that are either deployed to the cloud or run on-premises. It consists of modular components with minimal overhead, so you retain flexibility while constructing your solutions.
ASP.NET 5 includes the following features:
New flexible and cross-platform runtime
New modular HTTP request pipeline
Cloud-ready environment configuration
Unified programming model that combines MVC, Web API, and Web Pages
Ability to see changes without re-building the project
Side-by-side versioning of the .NET Framework
Ability to self-host or host on IIS
New tools in Visual Studio 2015
Open source in GitHub
The changes we made for ASP.NET 5 were based on customer requests and feedback. These changes simplify development, hosting, and maintenance, and are targeted to modern web apps.
Your legacy apps will run on the new version of the ASP.NET without any modifications. However, to take advantage of the new features in ASP.NET 5, you will need to port your existing code to the new framework. You will find many similarities between ASP.NET 5 and earlier versions of ASP.NET, so porting code involves fixing particular issues rather than re-writing the app.

Using ASP.NET MVC 4 and Web API components within a .NET f/w 4.0 and VS2010-constructed app

I'm a little confused about one thing with version levels of various .NET software components related to ASP.NET MVC and the web api. Now I know VS2012 and .NET f/w 4.5 are going RTM "real soon now", but I don't want to make that up-transition for awhile (as in 6 months or longer). I am coding a new app right now whose initial incarnation (dictated by consulting client) has to be .NET f/w 4.0 and utilizing VS2010 (yes I know you can target downwards with VS2012 but that is not an option for me in this case - as a consultant you are sometimes dictated the tools/versions etc that you MUST use for a contract). So finally to the crux of my question - I just came across an article on MSDN by Mike Wasson, written in Jan/Feb 2012 timeframe, and it looks as if he used VS2010 and .NET f/w 4.0, but demonstrating the new-ish Web API technology utilizing ASP.NET MVC 4. So it IS possible to install the ASP.NET MVC 4 component within the context of .NET f/w 4.0 and VS2010, AND utilize the Web API component? Which, if that is true, I might want to do with this particular project rather than just using ASP.NET MVC 3 (and without using the Web API stuff at all), which is what i thought I would need to do. It's just that I thought to use ASP.NET MVC 4 and/or the Web API stuff, one HAD to use .NET f/w 4.5 RC and VS2012 RC prior to Sep 12 (or their RTMs after Sep 12). Is that not correct?
You can use mvc 4 and web api with .net 4.0. You cannot use features of .net 4.5 in it but all other will work.
So it IS possible to install the ASP.NET MVC 4 component within the
context of .NET f/w 4.0 and VS2010
Of course. It's RC at the time of this writing but you could download and install it from here: http://www.asp.net/mvc/mvc4 (Download the standalone installer executable for VS2010 from here: http://www.microsoft.com/en-us/download/details.aspx?id=29935)
Even when it hits RTM you will be able to use it with VS2010. Of course you won't be able to use .NET 4.5 speicic features with VS2010 though (things like async/await).

Resources