Tag Archives: visual studio

MVC 5 for Visual Studio 2012

If you are still using Visual Studio 2012 and are looking for a way to have intellisense for your views made for razor 3, if you want to add a new view and a new controller with the proper menu entries in visual studio you probably noticed that with things don’t work as they should.

Simply install the following 2 components:

In case the links don’t work, check the original articles where I’ve found all the necessary information (thanks to them):

After installing these 2 components, you’ll finally be able to work on MVC5, just as you were used with MVC 4. Check these screenshots:


When you right click on “Controllers” and select “Add” you can now select “Controller…”


When you right click on your Views folder and then select “Add” you can now select “View…” as well as new entries (see MVC 5 View options at the bottom)


When you add a View, you can select a Model class and a Data context class, scaffolding will work also with Entity Framework 6


Visual Studio 2012 Publish Bug Fix

This is one of the biggest annoyances I’ve seen in Visual Studio 2012 and today I finally could find a working solution.

Issue: your Publish Profile is configured -for Connection– to use “File system” and when you try to publish, the files aren’t copied.

Probably you got the project from TFS. Your colleague(s) can normally publish the files but the publish does’t work for you. Quite frustrating, huh? Don’t panic.


Right click on your project. Click on “Publish” > Profile (first tab) > select the profile you need > click on “Settings” > the configuration is probably “Release“.

If this appears to be right: select “Debug”, close (save) then go back and repeat the same steps and select “Release”, then save. It should work.*

If this appears to be wrong, e.g. you have a configuration called “DEV” or “STAGE” or “LIVE” (as I do), select the appropriate one. Then publish. It works (tested).

Check the question Visual Studio 2012 Web Publish doesn’t copy files (see comment by firepol) on stackoverflow.

*See the most voted answer besides the “accepted answer”.


Visual Studio 2012 Templates

UPDATE: I added a GitHub repository and included my updates to the MVC4 Empty, Basic and MvcApplication templates. Feel free to contribute. See in the Download chapter.

So you use Visual Studio 2012, NuGet, you create a new project from the standard MVC 4 template and then you update all packages you need, or click on “Update All” and then “downgrade” one (e.g. jQuery 2.x to jQuery 1.x)?

If you need to update everything and downgrade just one package (in example jQuery), you can use the Package Manager Console and issue these 2 commands (first force the uninstallation of jQuery even if it’s needed by other libraries, then install the specific version you need):

Uninstall-Package jQuery -Force
Install-Package jQuery -Version 1.10.2

If you want your templates to be always updated, you may want to edit them directly (as usual, do a backup first), so that when you create a new project you won’t need to update all the NuGet packages. You may be interested in these 2 locations:

  • Templates folder: C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\ProjectTemplates\CSharp\Web\1033
  • Packages folder: C:\Program Files (x86)\Microsoft ASP.NET\ASP.NET MVC 4\Packages

In the Templates folder you can edit the *.vstemplate file and put the package versions you want. For the javascript files, remember also to update the Scripts\_references.js file. For the references, remember also to update the *.csproj (project) file. Some Libraries require you to update also the web.config file.

In the Packages folder you need to copy the nupkg file and the folder containing the package (take the packages from a new visual studio solution you create).

This seems complicated but once you updated your favorite template, it’ll be a piece of cake to maintain it.


To update your existing Visual Studio 2012 templates, just overwrite them with the files you find in my GitHub repository (do a backup of the originals, just in case).

If your favorite template is not here, sorry about that. I update only the templates I use the most for my projects. Feel free to share your updates (at best commit your changes directly in my github repository).

Other interesting resources for Visual Studio 2012