Strange issue with System.Web.Mvc losing its reference when checking out of TFS - tfs

I'm working with another developer on a project and everything has been working great until today. Now when I check out the solution to my Visual studio 2013, my reference to System.Web.Mvc is lost and I have to manually re-add it.
When I check in and she checks out, the same issue occurs for her. The path to the assembly is the same on both of our machines:
C:\Program Files (x86)\Microsoft ASP.NET\ASP.NET MVC
4\Assemblies\System.Web.Mvc.dll
but for whatever reason, we're not in sync. As I said above, it was working great until today so something must've changed...but I have no idea what???
Any suggestions/ideas of what to look for to resolve this?
TIA

This issue occurred due to a Security update that incremented the version of MVC. So if you had References in your project pointing to the hard drive where the 2.0/ 3.0/ 4.0 version was. Your project was needing that particular version. Another way to solve this is to use Nuget to update references.
This is a post from Microsoft regarding the issue:
http://blogs.msdn.com/b/webdev/archive/2014/10/16/microsoft-asp-net-mvc-security-update-broke-my-build.aspx

Related

The name 'Url' does not exist in the current context error VS2017

Getting an error The name 'Url' does not exist in the current context error in asp.net whenever I open a .cshtml file in my web project.
I should note that I got this solution fresh from our source repo and other developers tell me they don't see this issue.
Web project has a referenced to a nuget package and when I look at System.Web.MVC it's Mvc.4.0.40804
Things I've tried based on posted solutions:
1) Unloaded project and deleted .user file and did a clean and rebuilt.
2) Deleted temp ASP files in the .net framework directory.
There are a lot of other solutions saying to move views or adding to web.config file, but if other developers using same solution aren't facing this - I'm thinking it's machine specific.
I don't see any reference errors in the web project.
When I installed VS2017, I just did the ASP.NET development. So, i have no gotten another version of MVC. Could it be that?
Thanks,
Brian
So I ended up modifying my VS2017 install and under ASP.NET and web development, I uninstalled that and reinstalled and made sure ASP.NET MVC 4 was checked off under Optional.

Bad day fixing references in mvc 5.1 app

I have a problem with visual studio and nuget package manger
I was running very good when suddenly the project stopped to compile telling me that the ApplicationDbContext should derive from DbContext or something like that, i couldn't see the problem so i cleaned my solution rebuilt the project it compiled but had stupid runtime erros so I searched stackoverflow and the web And I found out it was a reference error in the first place so I removed the bin folder as described here in this question
higher version than the referenced assembly
then it went all bad i tried to remove all the references and re-install them manually but nuget PMC kept telling me that my project already had a reference to that assembly,, I closed Visual Studio re-cleaned the project and done that once again with no results!
so the question here would be how to re-install the latest version of everything to be compatible with asp.net MVC 5.1 without getting a message telling me that my project has a reference to those assemblies nonsense !
I had this happen to every one of my projects I upgraded to MVC 5.1. I had to add binding-redirects to my web.config. With the Package Manager Console it was easy.
http://docs.nuget.org/docs/reference/package-manager-console-powershell-reference#Add-BindingRedirect

Get InvalidCastException with Glimpse, even though it's not installed. How do I fix this?

I had a Visual Studio 2012 project that I imported into Visual Studio 2013. I upgraded Entity Framework to version 6. I got the following error when I started the first time: Unable to cast object of type 'Glimpse.Ado.AlternateType.GlimpseDbConnection' to type 'System.Data.SqlClient.SqlConnection'. Since this was a prototype app, I wasn't concerned about Glimpse, so I uninstalled it via NuGet, which removed the error and I carried on.
Now, I'm deploying to Azure websites and I keep getting that error!
Glimpse is uninstalled.
It works fine in release and debug locally.
I tried putting System.Data.Metadata.Edm.MetadataWorkspace.ClearCache(); in the Application_Start like this says. (Even though I don't run queries in Application_Start
I suspect I have a caching problem on Azure, but I'm not sure. How do I get the Azure deployment to remove Glimpse like the local install has?
Update: "Fixed"it by deleting the azure website and recreating it. Would still love to hear how to do with this without going with the nuclear option.
This is a bug and is fixed in the release that will hopefully be going out tomorrow - see here for more details https://github.com/Glimpse/Glimpse/issues/540.
I also faced this error and later on found the resolution.
Issue was that I had MVC5 and EF6 based solution and i had imported Glimpse.mvc4 and Glimpse.ef5 packages and they were incompatible i think .
Once i upgraded to Glimpse.EF6 and Glimpse.MVC5 it started working fine.
also had the same one, when I opted to remove Glimpse.
you can prevent this by deleting the bin/ and obj/ folders from your project folder(s) as Glimpse is copied to your bin during debugging.

Why does Visual Studio crash opening ASPX with MVC RC1

Upgraded from MVC Beta to MVC RC1.
Re-pointed all references in the project to point to the new assemblies
Rebooted
Everything compiles (and runs!)
But...
Opening a view (.aspx) in VS and she just disappears!
Event Viewer gives:
NET Runtime version 2.0.50727.3053 - Fatal Execution Engine Error (6E075E00) (80131506)
Update 1:
Not ALL .aspx pages!
Also - it seems that writing the question on StackOverflow is the fix! grr
Update 2:
Not had the problem since posting the question but:
The only plugins I have are VisualSVN and Resharper.
I do seem to have something in the GAC for System.Web.Mvc - but it looks like the wrong version and I can't get rid of it.
I believe it must be related to some intelli-sense colouring or similar during the render of the code of the .aspx page - but now it's stopped it is hard to confirm...
Try removing all bin/obj directories, and clearing your Temporary ASP.NET Files and %TEMP% directories. Then issue the following commands from a VS2008 command prompt:
ngen /delete System.Web.Mvc
ngen /delete System.Web.Abstractions
ngen update
Also ensure that all your references (MvcContrib, anything else built against MVC) are pointing to the same version of MVC as all the others.
This seems to have worked for me (so far)
There are some framework bugs that affect all VS add-ins etc if they reference System.Core v3.5. Start by clearing out the NGen cache. "ngen update", "ngen /delete [assemblyname]" or a sweeping "ngen /delete *" usually does the trick
More details + workarounds for this (and/or similar) issues here:
http://forum.huagati.com/topic5-addin-causes-ide-to-close.aspx
http://code.msdn.microsoft.com/PowerCommands/WorkItem/View.aspx?WorkItemId=8
http://www.jetbrains.net/devnet/thread/274657
Update: finally someone from MSFT acknowledge that there is a problem:
http://blogs.msdn.com/jnak/archive/2009/02/15/potential-crash-in-vs-when-using-the-mvc-rc-on-windows-azure.aspx
Update 2: An attempt at a workaround (VS2008 add-in): http://www.huagati.com/ProjectLoader/
Update 3: Microsoft has a CLR patch (KB963676) that fixes this problem. It is not available for download from microsoft.com but it can be requested through MSFT support / PSS.
Update 4: The CLR patch is now available for download from Microsoft Connect:
https://connect.microsoft.com/VisualStudio/Downloads/DownloadDetails.aspx?DownloadID=16827&wa=wsignin1.0
http://blogs.msdn.com/jnak/archive/2009/02/26/fix-available-asp-net-mvc-rc-crash-in-a-windows-azure-cloud-service-project.aspx
I had to remove the PowerCommands add-in to get VS working again.
I've had problems like that before. It was the webform editor. If you right-click the aspx file and choose "open with..." and select Html-editor the ide will most likely not crash on you.
Try disabling addIns one by one.
For me it was a conflict between gallio and testdriven.net I think.
Microsoft have now released a hotfix to resolve this issue.
See https://connect.microsoft.com/VisualStudio/Downloads/DownloadDetails.aspx?DownloadID=16827&wa=wsignin1.0
Phil Haack elaborates further here - http://haacked.com/archive/2009/03/06/hotfix-for-installing-aspnetmvc.aspx
I'm having the same problem and have posted a reply on the official ASP.NET MVC forum at http://forums.asp.net/t/1378448.aspx
I'm not sure, but are you also seeing reference to the Html helpers not showing up in the views (when they don't crash)?
I don't have Gallio installed, but I do have Resharper. I'll see if disabling that helps (although that would cause me a lot of anguish).
Update: Resharper wasn't the issue, but rather the plugin "Huagati DBML/EDMX Tools." It seems some plugins might be conflicting and I encourage people to disable all plugins as a preliminary step in debugging the crashes.
I have found that any compile issues with the master page or the page itself -- even warnings -- can cause this to happen. So close the project, delete the bin and obj directories, then re-open the project. Next open your master page(s) and any other recently changed aspx/ascx files. It is important to open all before you compile.
Now, viewing each page one at a time, compile the project and resolve the warnings. Once all the warnings are resolved, close the pages and try to re-open them.
I got the exact same error. At first I thought it was the Spark View Engine add-in (because it crashed opening views) but after Christian's comment about Gallio and TestDriven.NET (I have both) I uninstalled Gallio and now it works.
The problem was indeed, powercommands for VS 2008. Uninstall them if you can live without them and the aspx pages/designers will open fine.
Actually I think my problem was some rogue copies of the Beta MVC DLLs hanging around.
I deleted them all, uninstalled the RC1 and made sure they all left the GAC and then reinstalled the RC1. So far everything seems fine.
This occurred for me after setting the reference to System.Web.Mvc to Copy Local = True. This placed the System.Web.Mvc.dll file in my bin folder.
The next time I opened any aspx pages Visual Studio crashed. Changing the dll in the bin to System.Web.Mvc.dll.bak fixed the problem.
I finally (after a fews days of trying everything) got it resolved by uninstalling the Spark View Engine add-in, which crashed when opening .aspx and .js files!

ASP.NET MVC CTP5 Crashing IDE

I've recently installed the MVC CTP5 and VS is now crashing on me when I try to open an aspx, I get the following error in event viewer:
.NET Runtime version 2.0.50727.3053 - Fatal Execution Engine Error (7A035E00) (80131506)
I was able to find This post on the asp.net forums relating to the same issue but nobody has had a working solution yet (at least not for me).
Just wondering if anyone else has run into this issue and what they have done to resolve it?
EDIT: Wanted to add that I have tried all the tips in the article and can open the markup with a code editor but was wondering an actual solution had been found to resolve this issue.. Thanks!
EDIT: I don't have this issue on my Vista box, seems to only occur on my XP VM.
I had a problem with Power Commands and Preview 5. If you have Power Commands installed, try updating or uninstalling it to fix the issue.
Here are a steps to work around from the post that work for me:
1.Open project based on CTP5
2.IN solution Explorer, enable "Show All files"
3.Open "bin" folder and delete "Microsoft.Web.Mvc.dll", "System.Web.Mvc.dll", "System.Web.Abstractions.dll", "System.Web.Routing.dll"
4.Open "References" folder, click ONCE "System.Web.Abstractions" and in Properties window change "Copy Local" to true. Repeat same with System.Web.Routing.
5.Build application (Ctrl+Shift+B)
6.Open site.master in designer. VS will not crash.
FYI - Microsoft has released a hotfix that fixes [at least some variations of] this problem:
https://connect.microsoft.com/VisualStudio/Downloads/DownloadDetails.aspx?DownloadID=16827&wa=wsignin1.0
http://blogs.msdn.com/jnak/archive/2009/02/26/fix-available-asp-net-mvc-rc-crash-in-a-windows-azure-cloud-service-project.aspx
A bit of a null answer but I’ve been having this too. Not that I restart VS often but cleaning out the bin folder before opening the web project is my workaround.
Have same problem, on vista x64 and vs2008 sp1. Have to do probably something with cleaning bin folder and system.web.routing/abstraction, because it crashes even on webforms project with (mvc) routing in it. When I delete all files from bin, and add references again, it works fine.
Really annoying bug in vs2008+ctp5!

Resources