How to create custom scaffold templates in ASP.NET MVC5?

First, it looks like you have Visual Studio 2013 and 2012 both installed on your computer. I tried looking up the path you provided, I couldn’t find it. On your path it looks like you’re trying to use MVC4 templates. Here is my path: C:\Program Files (x86)\Microsoft Visual Studio 12.0\ Common7\IDE\Extensions\Microsoft\Web\Mvc\Scaffolding\Templates Below is how I … Read more

Application can’t scaffold items

In my case I moved my connection strings out of the Web.config to <connectionStrings configSource=”ConnectionStrings.config”/> that when I started getting the error when I was trying to scaffold. There was an error running the selected code generator: ‘Exception has been thrown by the target of an invocation.’ Moving my connection strings back to the Web.config … Read more

Uploading Files into Database with ASP.NET MVC

You could use a byte[] on your model and a HttpPostedFileBase on your view model. For example: public class MyViewModel { [Required] public HttpPostedFileBase File { get; set; } } and then: public class HomeController: Controller { public ActionResult Index() { var model = new MyViewModel(); return View(model); } [HttpPost] public ActionResult Index(MyViewModel model) { … Read more

Scaffolding controller doesn’t work with visual studio 2013 update 2

Hey for all of you that nothing works, the real answer is you need to remove ANYTHING that has a configSource on the web.config and the connection string needs to be inlined. EDIT: Someone pointed out that it needs to be only <configSettings>, <appSettings>, and <connectionStrings> tags NOT using a configSource attribute. And that he … Read more

“There was an error running the selected code generator” in VS 2013 scaffolding

VS2013 Error: There was an error running the selected code generator: ‘ A configuration for type ‘SolutionName.Model.SalesOrder’ has already been added …’ I had this problem while working through a Pluralsight Course “Parent-Child Data with EF, MVC, Knockout, Ajax, and Validation”. I was trying to add a New Scaffolded Item using the template MVC 5 … Read more