Visual Studio 2013 has stopped updating aspx.designer.cs files - asp.net

I'm working on a large-ish web forms application and VS has stopped updating .aspx.designer.cs files in the last few days.
It seemed like the designer updates initially became flaky (sometimes update, sometimes not) then stopped updating altogether. Now I have to manually edit the designer file after adding a control to a page before I can compile.
I've searched and tried all the suggestions like switching from markup to design view and back etc - no change. The only thing that kind of works is this but even then the generated designer file often doesn't contain references to all the controls on the page. And also that only works on a per-file basis. Ideally I would like the whole project to update/generate designer files correctly again.
I've tried cleaning the solution - no change.
VS details:
Microsoft Visual Studio Professional 2013
Version 12.0.40629.00 Update 5
Microsoft .NET Framework Version 4.6.00079
Installed Version: Professional
Any suggestions appreciated - thanks.

Make sure you're not running the application/site while adding controls. I've noticed that VS will lock the designer files while in debug mode and doesn't sync up when you exit debug mode.
Also, your link is broken, doesn't point to anything so I can't see what you were referencing to.

I think what caused this was a somewhat flaky local install of the project from TFS. It compiled but still had red squiggly lines under a few namespaces at design time. Once the project references were all clean the designer files were also updating correctly.

Related

Issue with upgrading project to Visual Studio 2019

I upgraded existing web forms app (c#) from Visual Studio 2017 Enterprise to 2019. While code is working fine, when I open default.aspx page - I get 123 errors (while code compiles fine). If I open it back in 2017 version - no errors
I had addressed couple of the errors but not sure what to do with the rest. Especially puzzling that code compiles with 0 errors. Errors show only if I open default.aspx
Most errors are CS0103 - the name 'name here' doesn't exist in the current context
Few errors CS0400 - the type or namespace 'project name' could not be found in the global namespace
Few CS1061 - 'default_aspx' doesn't contain definition for 'Context'...
I don't understand how it still compiles without errors and works? What changed with upgrade that those errors popped up? All those names and namespaces exist and there were no changes other than upgrade. New requirements? How to fix it?
Found a solution:
This is happening to projects that are using v1.0.0 of Microsoft.Net.Compilers. To work around this problem you need to update to the latest stable version which is 3.0.0.
All errors disappeared.
Looks like something broken with VS Intellisense since the compile and build sueeccded.
1.Before you open the web form project in VS2019, navigate to its Solution Directory and delete the hidden .vs folder there, after that open the project in VS2019 to check if it helps.
2.If the issue persists, try cleaning the VS component cache after close all VS instance:
Go C:\Users\xxx\AppData\Local\Microsoft\VisualStudio directory, you can find many 15.xx and 16.xx folders there, feel free to delete all ComponentModelCache folders in them and restart VS.

Visual Studio C# ASP .NET Web Form Designer Error

Ok, so I start a new project in Visual Studio (currently updated to update 3) and choose ASP.NET Web Application (.NET Framework).
Then I choose the Empty template and to add the folders and core references for Web Forms.
Ok, great, so I add a webform to the project and then find there's a problem:
Design view or even Split view is not available for the new aspx page.
Pressing the buttons 'Design' or 'Split' do nothing and only the source is seen, which also becomes uneditable.
Now I have seen this issue before and searched and searched for an answer. But the only solution was a complete reinstall - this means a few GB download and then hours of the install program doing whatever it does (it is the slowest install for anything on any platform).
This issue seems to occur randomly, and once it occurs, it seems to be permanent, short of a complete reinstall of VS.
Is this a fault in Visual Studio that will never be fixed?
Does someone actually know how to fix this other than a complete reinstall?
Please do not suggest to try 'Open With' on the aspx file - yes I have tried every option and the original default is the correct one.
Answers from the Microsoft forum are about as helpful as giving wheels to a tomato, such as here. It has even been highlighted for Visual Studio 2008 here. Someone seems to have tried to raise the issue last year here.

Cannot Git Diff CSHTML Files in Visual Studio 2015

I am using Visual Studio 2015 with ASP .Net MVC 6 on Windows 10. As far as I can tell everything's up to date, but I haven't changed anything recently that I know of. In the last couple of days Visual Studio has stopped letting me compare the current version of an *.cshtml file to see what changes I've made. It works for every other type of file I've tried, only these ones are being a problem.
I am getting the error message "Failed to start the configured compare tool." I've seen a couple of other posts (like this one: Visual Studio 2015 using Git unable to compare files and Microsoft Git Provider and Visual Studio 2012 failed to start the configured compare tool) but they seem to be talking about a more general cannot diff at all problem, which isn't what I'm seeing. It's almost as if git (or VS?) has decided to pick just this one file type to not like.
I have tried creating a new ASP .Net project with a new git repository and it sees the same problem, and the problem goes away if I rename the .cshtml file to give it a different extension. I've had a look in the .gitattributes file but can't see anything, though if I'm honest I don't really understand how git works beyond the basic 'this is how you drive it around when it works'. I've also tried removing and reinstalling everything git related I can find on my PC with no joy.
Anyone have any ideas on what I could have broken?
Update: I've just found this https://github.com/aspnet/Tooling/issues/293 which suggests that it might be related to an ASP .Net Update. Guess I'll probably have to wait and see.
Clearing the MEF cache appears to resolve this also. Close the IDE and delete the contents of this directory:
%LocalAppData%\Microsoft\VisualStudio\14.0\ComponentModelCache
Clear MEF Component Cache (Open VSIX Gallery) will probably do the trick as well.
Likely related to https://stackoverflow.com/a/32376450/1154135
This turned out to be related to a problem with the new ASP .Net tooling. They've apparently got a fix to be rolled out, but until then there is a workaround:
In the options panel, go to Options->Text Editor->HTML->Advanced
Set Identity Helpful Extensions to False
This is as per https://github.com/aspnet/Tooling/issues/293#issuecomment-161382206
Check your .gitignore file for references to .cshtml files. Dollars to doughnuts that something like *.cshtml is in that specific repo. Can you run the diff in git outside VS?

visual studio 2008 is freezing in design mode

It 's so weird issue :
My visual studio hang up ,consuming 25% CPU and then I have to use the task manager to shut it down.
This happened when i try to view the .aspx of the master page in the Design view .
After several attempts :
I has found that removing some references to css files fix the problem !!!! ..
But i want to use those css files .I wanna to know how some css files could freeze my visual studio !! ,and how to fix this problem .
I had the same problem too. Installing other programs may replace dlls necessary for the VS to run properly. Also, it is always better to avoid the design mode, in my opinion. That is why I use WebMatrix2. But there are sometimes where you REALLY need VS for which there is an integrated button in WebMatrix which opens the same website in VS. Even then, it is possible to completely avoid VS which I have been trying to do.
I suggest you try running the site with WebMatrix to see if it works fine with the css files you deleted.

Website running .NET 3.5 cannot use feature not part of ISO-2 specs

I am getting this error a lot:
Feature '{insert feature here}' cannot be used because it is not part of the
ISO-2 C# language specification
I am working on a .NET 3.5 website that I've worked on on and off for about two years. I've never seen this error before my most recent around of updates. I'm using a decent amount of LINQ coding throughout and I get these errors related to much of the LINQ code. Based on what I've read it seems like even though I'm using .NET 3.5, for some reason it thinks I'm using 2.0. But I can't find anything that says how to fix it.
One example of a problem is that if I try to add a new item to the App_Code directory, I do not get the option to add a LINQ to SQL dbml file.
If anyone can shed some light on how exactly I would fix this, I would much appreciate it.
I was unable to locate an "Advanced" option under the build tab. I have a feeling it is probably because it is a web app. I looked through the web.config and found 2 parts that may be important. Most things referenced 3.5.0.0 or v3.5. The settings are consistent with older backups of the web.config from when there were no errors. By the way, only intellisense and things within VS2010 are giving me problems. The website is running error free.
I have completed a total uninstall and re-install of VS2010 and I'm still having the same issue. I fired up my old install of VS2008 and I am NOT having this issue there. However, I would MUCH prefer to use VS2010 on this project.
I opened the website in VS2010 on my work computer, and there are no errors reported. This is making me think that there is something on my laptop that is causing the problem. As I noted above, I completely reinstalled Visual Studio 2010 and I am still having the problem. What does this leave? I have only one extension installed in VS, and it's the same one at work and on my laptop. Also, I did not reinstall the extension after reinstalling VS, and the problem persists.
Both PC's run Win7 Ultimate. Have VS2008 and VS2010 installed. VS2010 has the same extension installed on both. On my laptop I have the full version of SQL Server 2008 installed, but only the Management Studio on my desktop (we have a server in the office). Would SS2008 have anything to do with it?
Go to your project properties, the Build tab, Advanced - that should allow you to set which version of C# you want to use. It should default to the latest version supported by the version of Visual Studio you're using, but it sounds like at some point you've switched it to ISO-2.
(That's certainly true for Windows projects and class libraries - there may be a different location in a web app. In particular, have a look in Web.config.)
If this has only started happening recently, I'd have a look through your source control history at changes to any configuration files. Also try creating a new project of the same type, and see if that has the same problem.
Jon Skeet's answer is mostly correct. The location for the update is in the "Property Pages" which I got to by right-clicking on the name of the website, clicking Property Pages, the Build item, then target framework.
The extension I use, Solution Navigator, has it's own heading for the solution. Right-clicking on it DOES NOT give me the Property Pages option. By chance I right clicked on the title of the website under the solution heading and was presented with the Property Pages option. In there was the Build tab which contained the target framework option.
Once I finally found the target framework option, it was indeed set to .NET 2.0 for some reason. I changed it to 3.5, reloaded the solution, and now it works great.
Thanks a million Jon for your help and time working with me!!

Resources