Custom Scaffolding Extension Visual Studio 2019 - asp.net-mvc

I'm attempting to create a Custom Scaffold Extension for .NET Framework and Visual Studio 2019. I do not want to overwrite the default MVC T4 templates. I'm trying to do something like:
https://marketplace.visualstudio.com/items?itemName=robinliks.HappyScaffoldingforMVC5
I've found plenty of articles detailing the process for older versions of VS to include the SideWaffle projects but nothing that works with 2019.
Can anyone point me in the right direction?

Related

Change CRUD Scaffolder (Scaffolding) in Visual Studio 2019

I am using Visual Studio 2019, with .NET Framework 4.8, creating ASP.NET MVC 5 software (not Core).
I would like to use the CRUD Scaffolder from an older version of Visual Studio (e.g. 2017 or 2015). I have searched on internet and on Microsoft site; I cannot find anything. I do not have the older versions of software now.
In one of the older versions, the CRUD scaffolder created Views with simple code-
#Html.EditorFor(model => model.xxx)
#Html.EditorFor(model => model.yyy)
#Html.EditorFor(model => model.zzz)
along with of course the rest of the view code. And this is what I would like to do in VS 2019 (for just the scaffolded Views). I am looking to simplify the scaffolded view code (as was the case in older versions of VS).
QUESTIONS:
Is there a way to download and install/copy the older scaffolders?
If not the above, is it possible and easy to copy and modify the current VS2018 scaffolder code? Where could I find info on how to do it?
You will need to create custom scaffolding templates for that.
Here is a great link.
https://learn.microsoft.com/en-us/archive/msdn-magazine/2018/march/asp-net-use-razor-to-generate-html-for-templates-in-a-single-page-app
Scroll down to Changing the Scaffolding.
This is for VS 2017. The default template path in VS 2019 is C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\IDE\Extensions\Microsoft\Web\Mvc\Scaffolding\Templates\MvcView
You will also need to put everything in CodeTemplates\MvcView if you will be creating your own T4 template.
You will just have to install the older versions of VS to get their T4 Files.
Here is another great tutorial on how to do this.
Hopefully some of this helps.

Cannot making new controller after upgrade Visual Studio 2019

I cannot create a new controller on my ASP.NET MVC API. When I try to create a new controller, Visual Studio 2019 always throws an error (as shown in the screenshot):
I used Microsoft Visual Studio 2017 before, and it worked normally. But after upgrade, I have several issues with this IDE like creating controller in my existing project and cannot create a new ASP.NET Core MVC web application.
Hopefully anyone can help me.
Thanks in advance
That error message means there is no relative templates when you try to add the controller using visual studio wizard.
Try to install MVC 4 Package.
This link might be helpful too Modify Visual Studio

visual studio 2015 editor vs visual studio code for angular 4

I have created data access layer ,Business access layer and web api as separate projects in one visual studio solution.
I am trying to implement angular 4 project using angular cli. Is it better for me to include angular 4 as a class library project and add to the existing solution or do I avoid adding it to the solution and just use visual studio code to open it.
I need to know which is the better code editor to use as far as angular 4 is concerned.
I would argue that nowadays both VS Code and Visual Studio 2017 offer similar experiences. You can check my blog post here for more information:
https://blogs.msdn.microsoft.com/wael-kdouh/2017/09/05/should-i-use-visual-studio-2017-or-vs-code-for-my-next-angular-application/
If you want to successfully use the Angular CLI, the VS Code would be much easier than trying to merge the result into a Visual Studio project.
Alternatively, you can use the new dotnet new angular and use Visual Studio's template. See this link for more information: https://dotnetcore.gaprogman.com/2017/04/20/dotnet-new-angular-single-page-application-setup-and-how-the-template-works/
Most devs I know are going with option 1 and using the CLI and VS Code for the Angular piece and Visual Studio for the back-end piece.

Unable to create MVC View using scaffolding in Visual Studio 2013 Ultimate Update 5

I recently applied Update 5 to Visual Studio 2013 (Ultimate Edition) running on Windows 8.1. After the update, any time I try to create a Razor View (*.cshtml) file in my MVC application using scaffolding, I get the following error:
There was an error running the selected code generator:
The Templates\PackageVersion5.1.3.xml file is missing from the
installed template folder
From the error, it is clear that some file (PackageVersion5.1.3.xml) is missing but I'm not sure how to fix it. I even repaired Visual Studio but to no avail.
As yoo probably know during scaffolding your view is generated base on this missing xml file. I don't know why your file is not there but you can copy it from one of your colleagues computer or reinstall visual studio.
Maybe you have change something i VS options?
I avoid the scaffolding options in Visual Studio.
Why? In my experience, the standard MVC pattern where everything separated by type will always led to a difficult to manage and test solution.
Instead, I now prefer to organise MVC projects by feature (http://timgthomas.com/2013/10/feature-folders-in-asp-net-mvc/).

Create and Run MVC 5 Project in VS 2012

For some reason my Visual Studio 2013 Preview cannot create MVC 5 Projects. Since the MVC project is now open source in CodePlex I was wondering if there's a simple way to develop MVC 5 projects in my Visual Studio 2012 Ultimate.
Microsoft has released updated Web Tools 2013.1 that provide the support:
Description
Direct download
Note that I had to install it manually from the second link, the tools did not install properly from Web Platform Installer. Also a colleague had to install both Update 4 and these tools to get proper support.
Original answer (not actual anymore):
I received this answer from Microsoft developer:
MVC 5/Razor 3 tooling support for VS 2012 has not shipped yet. We hope to ship this support in Mid November.
Recently ASP.NET Program Manager from Microsoft mentioned in a talk that this would be included in VS2012 Update 4. Edit: unfortunately the support is not in Update 4.
So the accepted answer is true for now but we can plan to soon have this support in VS2012 as well.
A new tutorial has been recently added to the ASP.NET website on how to upgrade an MVC4 project to MVC5.
I migrated a VS 2012 project using this tutorial without problems, but there is no design time support for Razor 3 in VS2012 due to changes in the way VS loads the razor engine.
You can edit razor pages in VS2012, but it will be a plain HTML editor.
Microsoft has released an update for this, Web Tools 2013.1 for VS2012.
http://blogs.msdn.com/b/webdev/archive/2013/11/18/announcing-release-of-asp-net-and-web-tools-2013-1-for-visual-studio-2012.aspx
I'm not sure MS will fix it.
The bug report says problem closed : by design
https://connect.microsoft.com/VisualStudio/feedback/details/806348/razor-intellisense-does-not-work-in-visual-studio-2012-after-upgrading-to-mvc-5-razor-3
and it is mid November
I have a tutorial that will not only get your empty MVC 5 project working with Bundling, a controller, jQuery, jQuery UI, Modernizr and more, but it will walk you through installing Zurb's Foundation 5, a responsive Framework which I have working with Sass in MVC 5. It's all here:
http://tinyurl.com/VS12-MVC5-F5
The problem many have ran into is that Visual Studio 2012 only allows you to start from a blank MVC 5 project, so I will help you get the NuGet installed which is pretty similar to the instructions in the NuGet package with a few minor changes; however, it does not take into consideration that you will be installing from Visual Studio 2012 using a Blank MVC 5 project. If you would like to use Foundation 5 with MVC 4 Web Application template just omit the Bootstrap uninstall and the NuGet package should work fine, but if you need to use MVC 5 and you don’t have Visual Studio 2013, you will need to build the Home Controller, Bundling class, modify the Global.asax.cs as well as other quirky little things. So lets get started.
I spent a good part of a few hours getting it all working.

Resources