Having problem with the shortcuts for MVC specifically in VS2012.
The key combination (CTRL+M, CTRL+G) is bound to command (Go To View)
which is not currently available.
But for example Refactor->Rename work.
Disabling ReSharper doesn't help.
It works in VS2010, but not in VS2012.
I have looked at the related question: Shortcut keys not working (Visual Studio 2010 with ASP.NET MVC 3 RC1)
Had that problem previously in VS2010, and the accepted answer solved that problem.
I had this problem too. The problem was with the project file and this worked for me:
Create a new MVC project (you can use the Basic template)
Open the newly created project file and copy the <ProjectTypeGuids> element
Open the project file giving the problem and replace its <ProjectTypeGuids> element
Reload the project and it should work.
Related
I've been through a lot of similar issues, but could not find anything that worked for me.
I'm upgrading my IDE from the VisualStudio for Web (v10) to Visual Studio 2015 (v14, I guess) Community Edition.
The main project that I'm trying to use on the new IDE is a MVC 5 (5.2.3), with EF 6.1 (6.1.3) and a bunch of other stuff.
Problem is: When opening the project on the new IDE, everything looks fine (it even compiles and work). I got the MVC context menu working on the project explorer (showing the "Add Controller..." and "Add View..." when appropriate). Only (really annoying) thing is the Razor Intellisense.
When I do open a View file (.cshtml) I receive warnings on several helpers, some of the "using" are greyed out (even though they're supposed to be needed) and the #model myModel is shown like everything after the #model directive is not razor (it's treated like HTML by the intellisense coloring).
What I've already found and tried:
I've already tried to clear the UserData from the vs (devenv /ResetUserData)
I've already tried to run the VS2015 in safe mode
I've already tried to run VS2015 as Administrator
I've already tried to set the Project's target framework to 4.5.1 (used to be 4.5)
I've already tried to open the project on Visual Studio Community 2013 saving it there before trying to use it on VS2015.
When creating another MVC project from the VS2015, everything works fine.
Here's an example of the annoying issue:
Ok, finally got it.
Posting what I found out believing it may help someone else:
What seems to cause the problem mentioned is the fact that the project was created on an old MVC version (with older Razor, EF, etc).
As stated in this answer: Visual Studio 2015 Razor View MVC Types not recognized, VS2015 tools may not work for older MVCs.
The solution is to update all your packages to [at least] the minor versions accepted on newer MVC (5?). To do so you can use the list in this website: http://www.asp.net/mvc/overview/releases/how-to-upgrade-an-aspnet-mvc-4-and-web-api-project-to-aspnet-mvc-5-and-web-api-2.
Once everything is up-to-date, open the web.config files located on root of your application and on the Views folder. In there, you will probably find some references to the older versions of MVC and Razor. Update those versions values (all of them) to match the updated versions of your packages (you may create a new empty MVC project on the new Visual Studio and check for those values as a hint of what they should be).
This step is the catch! Since, even if you update you project's packages, some web.config references may still mention the original versions.
Clean the solution (Build > Clean Solution) and close the project. Reopen and compile it. Now [hopefully] everything should be working fine.
[Edit]
One more thing: If your project was also updated from Framework 4.5 to 4.5.1 during this IDE transition, you should also install a NuGet package called "Microsoft.CodeDom.Providers.DotNetCompilerPlatform" (as stated in https://support.microsoft.com/en-us/kb/3025133).
I've got an old project from a friend that he wants me to do redo. How ever that project is written in ASP.net mvc2. So When I try to open it in visual studio 2013 I can errors. Saying the file is incompatible. How would I go ahead and fix this?
I would highly recommend you to create a new empty MVC 5 project, and move all your files there from old MVC 2 project. If you just try to update DLLs its very hard be sure if you updated all DLLs, proj file, nugets, or at least little bit more work by copying files is well worth it. Problem is that VS2013 is not compatible with old version of MVC framework.
But, if you really want to open MVC 2 solution in VS2013, you can try following some steps described here: How do I open an old MVC project in Visual Studio 2012 or Visual Studio 2013? (contains a project Guid that needs to be changed inside .proj file)
i'm working on a project which is using mvc 5,ef 6.1, visual studio 2013. First i start coding from admin panel after its done i get back to admin panel for some changes.
Then i got those errors : http://prntscr.com/34tuby
ViewBag, Html Helper is not recognizing.
Project can compiling and working but when open a cshtml (view) file in visual studio i got those error.
for solution i tried;
Clean/Rebuild Project
Compare web.configs
Compare View web.configs
Compare project properties
Compare packages config
all packages same, web.config files same , all packages version same with working project.
-Thanks
Try checking your configuration file, as mentioned in this SO post. It's usually related to config entries not matching the correct DLL's.
I create new project and transfer all files with same namespace. And it work
I've installed the "ASP.NET and Web Tools 2013.1" in my Visual Studio 2012.
I have a solution which has an ASP.NET MVC 4 project with the following project type guids:
<ProjectTypeGuids>
{E3E379DF-F4C6-4180-9B81-6769533ABE47};
{349c5851-65df-11da-9384-00065b846f21};
{fae04ec0-301f-11d3-bf4b-00c04f79efbc}
</ProjectTypeGuids>
These Guids are for:
ASP.NET MVC 4.0
Web Application
Windows (C#)
This is the usual configuration when you create a new ASP.NET 4.0 project. And it works fine.
The problem is that, for some strange reason, whenever I open my solution the first GUID (ASP.NET MVC 4.0) is deleted from the .csproj file, so I lose all the related tooling.
No matter how I try to edit it:
if I close the solution, and edit this file manually, adding the missing GUID, when I open it again, the GUID is deleted
if I unload the project, edit the .csproj and reload it, the GUID is also deleted.
I have this project under version control (SVN), so I have also tried closing VS, updating the file in the SVN (using Tortoise) and reopening the solution. And you know what? The GUID is deleted when opening the solution !!!
If I create a new solution with an ASP.NET MVC 4.0 project, it works fine, and the GUIDs are kept.
Any idea why this can be happening and how I can solve it?
UPDATE
If I open VS in safe mode this doesn't happen. SO I suspect it must be an extension, but I don't know how to discover which is the offendign extension. Is there a way to know which extension can be responsible for this (apart from uninstall/try cycles...)
I found a temporary workaround hack for this problem:
Right click on the MVC project in Visual Studio and select "Unload Project"
Right click on the project and select "Edit YourProjectName.csproj"
Replace the contents of the ProjectTypeGuids tag with the following and save the file changes:
{E3E379DF-F4C6-4180-9B81-6769533ABE47};{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}
Open up Window Explorer and find the csproj file. Open up properties on it and mark it as Read Only.
In Visual Studio right click on the project and select Reload Project. You will be prompted to save as the csproj file. Hit Cancel when that comes up.
Go back to Windows Explorer and take off the Read Only flag.
As long has you have this project open in Visual Studio, it will think it's an MVC project, and you will have options to Add Views and Controllers. Once you switch projects or restart Visual Studio, you'll have to do this again.
I'm using VS 2008 with SP1, on WinXP Pro, and I successfully installed the MVC package from Microsoft. I start a new project, select the MVC web project type, and give it a name and folder. When I press go it hangs forever.
The "ProjectName" folder is created, but nothing else is there.
I can create and open all my other projects without any issues.
Any ideas what's causing this issue? I can't try the MVC framework if I can't create a project!
If you use Process Monitor & Process Explorer, you can probably find out what VS is waiting for.
PM: http://technet.microsoft.com/en-us/sysinternals/bb896645.aspx
PE: http://technet.microsoft.com/en-us/sysinternals/bb896653.aspx
I had a similar issue: Instead of uninstalling Visual Studio add-ons I tried the fix.
I found this blog post form the VS team:
http://blogs.msdn.com/webdevtools/archive/2009/03/03/hotfix-available-for-asp-net-mvc-crashes-with-azure-power-commands-resharper.aspx
that points to a fix:
https://connect.microsoft.com/VisualStudio/Downloads/DownloadDetails.aspx?DownloadID=16827&wa=wsignin1.0
It Worked!
Give a try to ASP.NET MVC 2 Preview 2.