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

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!!

Related

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.

Visual Studio 2013 has stopped updating aspx.designer.cs files

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.

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?

Context menu has no "Add Scaffolding" nor "Add Controller" options

I'm trying to get started with ASP.NET/C#, and I'm doing so by following along some guides and tutorials.
One major issue I keep running into is that I have no Add Scaffolding in the context menu, nor Add Controller. I can't figure out a workaround for the lack of the Add Scaffolding.
There are various relate posts on SO. I will address some:
How to Add Controller
The accepted answer says something that directly contradicts my experience. There is no Add Controller option anywhere.
Reload the project
Reinstall suggested in this comment
I've tried uninstalling and reinstalling several versions. So far I've tried VS2013 Express for Web, VS2013 Community, and right now I'm using VS2013 Ultimate. Each one has had a fresh install installed within the month.
Add a guid
I tried adding a guid to a .proj file, an idea from another question at the moment of which I cannot find.
Same issue in Sep 2014, no answer
I realize there are several questions with the same issue, but none of the answers address my situation. Of the solutions I've seen proposed, I can't get any of them to work. Maybe I'm copying the guid's in the wrong place, maybe I'm not uninstalling correctly, I'm not sure.
I haven't yet tried to uninstall everything related to VS. I have a lot of random product on this machine. I wasn't aware that, for example, "Microsoft Visual Studio 2010 Tools for Office Runtime (x64) or Microsoft Visual Studio Tools for Applications 2.0 - ENU could disrupt VS2013 features. If anyone has information about this please let me know. I don't know the extent to which I would have to uninstall stuff in order to find the root of this issue. My Programs and Features menu is littered with MS product that I can barely tell apart.
EDIT:
Some Background Info:
I am using Microsoft Visual Studio Ultimate 2013 Version 12.0.31101.00 Update 4, and Microsoft .NET Framework Version 4.5.50938.
I used no special install instructions.
It's a web application. File > New Project... > Installed..Templates..Visual C#..Web..ASP.NET Web Application > MVC.
Upon Dleh's suggestion, I looked for the Add > ... buttons after changing the project type. I selected File > New Project ... > Visual Studio 2012 > ASP.NET MVC 4 Web Application (.NET Framework 4.5.1) > Internet Application, and I am confused to report that there is an Add > Controller... button. I have no idea what is happening.
Also, of note, I (within the week) installed VS2013 Ultimate on my home machine, and I have having none of these issues.
I believe I have solved the issue, but I don't know exactly what I did.
One answer from here was part of what prompted me to uninstall a number of MS products and features. Unfortunately, I can't remember the exact program or feature I uninstalled.
It seems like the uninstalling of related programs and features fixed the issue. By "related programs and features" I mean anything in the Control Panel > All Control Panel Items > Programs and Features menu that had ".NET" or "Visual Studio" or "Microsoft * Web Tools" or of the like. Many of them required a system reboot after uninstalling, and after one system reboot, the desired features in VS2013 was there.
There were on the order of 20-30 MS+VS+.NET related programs, and I uninstalled about 15.
I can't remember exactly which one I uninstalled, but it was anything that look remotely old and related to VS or .NET. Even if it was recent, I always figured I could reinstall stuff if I got the wrong thing.
Hopefully, anyone going through a similar issue will find this helpful. Good luck.
Had the same issue, installing
AspNetWebTools2013_1Setup.exe
WebToolsExtensionsVS.msi
fixed it for me.
Link Here

Visual Studio 2010 hangs when starting asp.net site debugging

i have problem with Visual Studio 2010 on Windows 7 x64. When i started asp.net site debugging, it stoped working. Only solution is restarting IIS.
Have anyone experiences with this?
Thanks
As Peter mentioned, manually attaching through the Attach to Process dialog should work.
Another option is to temporarily update your project to .NET Framework v4.0. In the IDE, this can be done in 'Build' section of under project properties.
We are still investigating the issue to find a longer term solution.
Sorry for the inconvenience that this problem has caused.
This M$ Connect article points straight to the topic: http://connect.microsoft.com/VisualStudio/feedback/details/556000/vs-2010-hangs-when-debugging-asp-net-3-5-web-application-or-website
Apart from the different intermediate solutions proposed, there seems to be an official Microsoft VS 2010 HotFix available here: http://archive.msdn.microsoft.com/KB2106584/Release/ProjectReleases.aspx?ReleaseId=4834.
HTH
Here's a workaround that helped me:
Go to Debug->Attach to Process. If the 'Attach To' box says 'Automatic: Native code' then click the 'Select...' button. In the 'Select Code Type' dialog change the option from 'Automatically determine the type of code to debug' to 'Debug these code types' and choose ONLY the options for you project. For me this was 'Managed (v2.0, v1.1, v1.0)'. Click OK. Then click Cancel in the 'Attach to Process' dialog.
At this point I'm now able to do F5 Debugging.
I hope this helps!
For what it is worth I had this problem this morning out of nowhere. In my case I am converting a database into webpages and one of the folders of one of the projects in my solution now has over 200 thousand html web pages. As soon as I one off'd my solution and removed the project with the giant folder debugging worked again.
This is not unlike what happens when performing a global search and vs 2010 tries to search a folder with an enormous # of files.

Resources