how to add asp.net mvc templates for monodevelop - asp.net-mvc

I'm on archlinux using mono 4.0.4 and monodevelop 5.9.
By following the Getting started guide I noticed there are some scaffolding options missing, I see some nuget packages for scaffolding but installing them didn't do much.
SO has these two questions :
How to get the MVC 3 or 4 template in MonoDevelop?
Developing ASP.NET MVC using MonoDevelop on MAC
The latter is for Mac and both of them are outdated As I'm talking about asp.net mvc 5 here.
searching didn't reveal anything apart from the Nuget packages I added and I can't see any addins in the add-in manager for this(prefer not to use beta or alpha addins).
So what to do to get these ?
P.S:
I know I can get them with yoeman but I like to use monodevelop, if yoeman can be integrated with monodevelop So I can see options like "model with view and controller" scaffolding(that is a CRUD ready application) then I'll do it.

I am assuming you are talking about the templates that are available in an ASP.NET MVC application when you select Add View or Add Controller. If this is not the case then please update your question with more information.
The templates listed when adding a new view or controller to an ASP.NET MVC project are taken from t4 template files (.tt) in the following folders:
AddIns\AspNet\CodeTemplates\CSharp\AddController
AddIns\AspNet\CodeTemplates\CSharp\AddView\Razor
You can add extra .tt files into this folder and they will be displayed in the Add View and Add Controller dialog.
Out of the box MonoDevelop/Xamarin Studio only has a few t4 templates available so you would need to either write your own or find some from elsewhere. SharpDevelop has more T4 templates or MVC which could probably be used but may require some modification.

Related

Visual Studio Update 2015, many options for ASP.NET MVC project missing

I just installed Visual Studio 2015 Update 1, and a lot of the configuration I was used to is missing or different. I'd like to know if these changes are due to something simple (like a package I need to install), or if it's something a little more complex.
I'm mainly using Visual Studio to create MVC apps from scratch, so before the update, I would create an empty MVC app with the "Add core references and folders for MVC" selected. Now, I can only create an empty MVC project with nothing pre-configured, or a fully scaffolded MVC app.
In the empty MVC project, there's no option to "Add Controller" when I right-click the "Controllers" folder I create. However, this option is available in the generated one.
The Add New Item menu is divided into Server-side and Client-side templates for the generated app, but it's divided into Code/Data/General/Web/etc. in the empty app. There's also an option to add an MVC View in the generated app, but there's nothing with Razor for the empty app. No .cshtml intellisense in the empty app, either.
There's a lot of functionality and options missing from the empty app that seem like they have to do with how the app is an MVC app, since they're available for the generated app. Is there a straightforward fix that will allow me to create an MVC app using Razor from an empty template?
Figured it out! I was using the ASP.NET 4.5.2 Empty Template, and choosing the ASP.NET 5 Template solved the problem.

No ASP.NET MVC 5 Web Application Template on VS 2012?

I'm using Visual Studio 2012 and have just installed "Microsoft ASP.NET and Web Frameworks 2013.1 - Visual Studio".
As expected, it added the option to create an "ASP.NET MVC 5 Empty Project". The thing is, I see no way of jump-starting an already functional "base application" as I had when I was using MVC 4 (e.g. "Asp.NET MVC 4 Web Application"). I only see an empty template.
I've seen answers such as:
How can I add the MVC 5 project template to VS 2012?
Create and Run MVC 5 Project in VS 2012
Direct download link to ASP.NET MVC 5 for VS 2012
And found this article on the matter.
This is obviously not a show-stopper as I can always create the application from a scratch, but I still would like to know if it is possible to achieve that on VS 2012. Did I miss a step, or do I need VS 2013 for that? A fully functional Web application template (with authentication etc.) would be nice to dabble around MVC 5's new features or for prototyping.
After creating a new project using ASP.NET MVC 5 Empty Project, you can right click on the project, then click Add.. > New Scaffolded Item..., select MVC on the left, then MVC 5 Dependencies and choose Full dependencies from the prompt.
This will add a default layout (Views\Shared\_Layout.cshtml), Content folder, Scripts folder with bootstrap, jquery, modernizr, etc, and other things the Web Application template creates.
If you get the error "CS0103: The name 'Styles' does not exist in the current context" just add <add namespace="System.Web.Optimization"/> under <namespaces> in Views/web.config
The answer from Sean Lynch is nice but not really complete.
However there is this nice guy that took the time to prepare the template just like in Visual Studio 2013. You will get everything down to the bootstrap template and pre-configured database table for authentication.
All you need to do is change the DefaultConnection in Web.Config to you SQL Server and voila all the relevant authentication table will be created for you.
Archive of the original blog (by web.archive.org)
Update
The original blog is no longer online, but thankfully his template is still online. You can download the MVC5 Template for Visual Studio 2012 Here:
Direct link to MVC5 Template For Visual Studio 2012
And here is the excerpt from the original blog:
Installing the template is very simple, there are just two steps:
Copy it into the following folder of your computer (creating the directory structure if necessary):
%USERPROFILE%\Documents\Visual Studio 2012\Templates\ProjectTemplates\Visual C#\Web
Once you’ve done this, simply restart Visual Studio and you will have this template available in the dialog box to create a new project under “Visual C# > Web”.
Now you can create applications with a little more shape than the mere empty structure provided by default and enjoy the benefits of adopting Bootstrap and its responsive design, a full membership system and user authentication, bundles, filters, some content pages, etc.
You have 2 option to fix it.
Install the latest 2013 version which have MVC5 support inbuilt (VS2013 missing MVC3 and ASPX file template (ASPX templates will be added in future))
stay with 2012 update 4. Read my old article to get it fixed http://geekswithblogs.net/anirugu/archive/2013/11/28/mvc-5-in-visual-studio-2012-update-4.-how-to.aspx
I'm not using 2012 now, but rather 2013, and I see the mvc 5 template there. However, I did this a while back before I had any mvc 5 templates showing up by installing mvc 5 first. You should be able to download from http://www.asp.net/mvc/mvc5.
Also make sure your target framework is set correctly.
Then I updated the web config like this:
You have to have the correct versions of the assemblies. I googled a lot to get this info, so it should still be available if you do some research.

Does a template for asp.net mvc 4 built on the Semantic UI framework exist?

I know Twitter bootstrap has several templates rolled with mvc 4 when creating a new project, but does one using Semantic UI exist? Google searches returns little of relevance to me, neither am I able to find any when searching amongst the online templates in VS2012.
No, it doesn't exist out-of-box, but you are free to create your own template. The templates for MVC in both 5 (VS 2013) and 6 (VS 2015 preview) are also using Bootstrap.
Alternatively, you can add the NuGet package to your project (though, it does not seem to be an official project package):
PM> Install-Package SemanticUI.ASP.NET.MVC

Where to put custom view templates in MVC 3?

I want to create a replacement T4 template that can be called from Visual Studio's "add view". Where should I put the file? I'm not sure I should put it in
C:\Program Files\Microsoft Visual Studio 10.0\
Common7\IDE\ItemTemplates\VisualBasic\Web\
MVC 3\CodeTemplates\AddView\VBHTML
I suspect it will get wiped during repair etc if I put it there.
You can put your custom T4 template under your project like this:
{YourProjectFolder}\CodeTemplates\AddView
Of course this way it will only be enabled for this specific project, while putting them in the location you mention in your question will enable it for all your projects system wide.
Here you can find an interesting article going further into the details:
T4 Templates: A Quick-Start Guide for ASP.NET MVC Developers
There's even already a nuget package who does all the plumbing for you:
Add the ASP.NET MVC 3 Code Templates to your application with Nuget
create the following structure in the ROOT of your Project (Not solution):
CodeTemplates\AddView\VBHTML (in your case, or CSHTML for C# razor views) and copy the templates from that folder into the newly created VBHTML folder.
Also in set the Tool property in the files' Property to empty, otherwise it will ask to build the *.tt file every time you save. Also consider using Tangible T4 Editor extension for Visual Studio to edit the templates. It's available on http://visualstudiogallery.msdn.microsoft.com/
There are two possible locations. Either the one you showed which will be global for all projects on the system or in ~\CodeTemplates\AddView\VBHTML\MyTemplate.tt if you want this template to be available only for a given project. Here's a blog post about it.

How to write an MVC3 Project Template that will offer option Razor or .aspx views

I have written two separate project templates to create MVC3 projects (both based on the standard Microsoft template, but with additional controllers/views of my own) - one with ASPX views, and the other with Razor views.
But, rather than have two separate templates, I would rather mimic the way that the Microsoft MVC3 template works, which offers both view engine options, selected in a second dialog. I know that this is done with a Wizard, but I can't find the Wizard in the MVC source code (which I've downloaded). Does anybody know where to find the Wizard, or have other helpful suggestions? Thanks.
The custom MVC New Project dialog exists in Microsoft.VisualStudio.Web.Mvc.3.0.dll. We do not ship the source code for that assembly.
I used the Export Template Wizard to create an ASP.NET MVC3 Project Template of my own. This worked OK, but did not offer the same options that Microsoft ships with their Visual Studio MVC assembly. I also ran into an issue where the strongly-typed views were not being updated with the correct namespace. They were keeping the namespace of my original project, while the Controllers and Model was correct.
We would love to have the source code made available for MVC 3 Project Templates!
Here is the Wizard I used. It definitely comes in handy. http://visualstudiogallery.msdn.microsoft.com/57320b20-34a2-42e4-b97e-e615c71aca24/
Phil Haack has documented how to create a custom MVC3 project template that will appear inside that wizard (as opposed to a normal project template that won't)
haacked.com/archive/2011/06/06/creating-a-custom-asp-net-mvc-project-template.aspx
If you follow that process you'll only end up with razor as the possible view engine. To get other view engines, you need to expand the reg files to list spark etc. Details on doing that are provided in this stack overflow answer:
Add custom viewengine to New project dialog?

Resources