System.Web.Helpers not found in VS2015 - c#

I'm trying to add some JSON parsing to the C# code in VS2015 but I can't find:
System.Web.Helpers
as the MS documentation suggests. I've looked at other people's questions of a similar nature (almost all on earlier versions) and the answers all say to add it in the Assemblies / Framework dialog.
The problem is it doesn't appear in that dialog, nor do many of the other things I see people talking about.
I would really appreciate any help on fixing this.
Here is the list I have access to:
Edit: Added the Extensions window as well

This question is a bit old but here's a simple solution - Microsoft seemed to just move this library to a Nuget package called "microsoft-web-helpers". Installing that package seems to be equivalent to having the assembly.

Old question but might still help someone.
You must install MVC 3 in order to have the System.Web.Helpers Extension on VS2015.
link to download: https://www.microsoft.com/en-us/download/details.aspx?id=1491

You cannot find it because of the simple fact that's not part of the Framework assemblies (what you are looking at).
It's part of the Extensions assemblies, and, as posted here, you will find it under "Extensions" in the left-hand side of the dialog.

I was wanting to work with JSON as well in an ASP.Net project using VS2015.
I ended up here trying to find answers. Right about the time I finished reading the other answers on this post I noticed my project already had a reference to Newtonsoft.Json. Never heard of it before so I looked it up; I'm glad I did.
It was literally a one liner to Serialize a List<String> to JSON.
You can pass in an Object so you should be able to serialize most any Object within reason.
Ultimately I didn't need to install MVC3 or reference System.Web.Helpers
Hope this helps!
NewtonSoft Serializing and Deserializing JSON

I stumbled upon the same issue and fixed it by adding NuGet Package ->
Microsoft.AspNet.WebPages

Related

Where is System.SpanExtensions?

Net core 2.0
I'm trying to find NonPortableCast() the api browser shows it here:
I've referenced System.Memory - but I cannot find this method. Its pretty new so I'm not seeing much in the way of online discussion around it either. Additionally all articles I've found that talk about it, dont seem to mention where it is located.
I've referenced System.Memory and opened the assembly in JustDecompile and I dont see SpanExtentions in there anywhere.
It appears that the inclusion of this in the documentation for the 2.0 release was a mistake:
https://github.com/dotnet/corefx/issues/30156

Install Microsoft.AspNet.Identity.EntityFramework.3.0.0-rc1-final into Class Library

I'm trying to create a class library for the new Microsoft Identity model but am being beaten back by an odd error.
If I create a regular C# Class Library (not a PCL) and attempt to install Microsoft.AspNet.Identity.EntityFramework.3.0.0-rc1-final via Nuget it goes so far, chokes, rolls back and then displays the following error:
Failed to add reference to 'System.Runtime'. Please make sure that it
is in the Global Assembly Cache.
I know that this is a pre-release version of the library but this cannot be such a radical idea that I'm trying to achieve here.
Any pointers greatly appreciated.
It seems to be a known issue and confirmed by Microsoft. It leads to this NuGet issue.
A workaround, according to the comments, is to install Microsoft.AspNetCore.Identity.EntityFrameworkCore, which is the RC2 equivalent. From what I can find this hasn't been officially released yet, and you might need to build from source.

Cannot define a class or member that utilizes 'dynamic' because the compiler required type 'System.Runtime.CompilerServices.DynamicAttribute'

I'm trying to run a .NET MVC application on my local computer that I got from GitHub.
When I hit run on Visual Studio, everything complies and a new browser window opens with the error:
CS1980: Cannot define a class or member that utilizes 'dynamic' because the compiler required type 'System.Runtime.CompilerServices.DynamicAttribute'
The compiler section in the same window, shows the following error:
I've checked on google and this seems to be the same error.
This guy was using a dynamic type himself, on the other hand I'm not using any dynamic type, this is being auto generated by .NET's compiler, and I'm using .net 4.5 which should has support for dynamics.
I tried to apply the same solution (Changing all System.Core references to 4.0)
but the thing is that all of them are version 4.0 already.
Do you have any idea how could I resolve this?
I had a similar error on a project I was trying to migrate. Try re-targeting the framework of the project back a version or two, and once you find a target version where you do not get the error, re-target back to the version you originally had trouble with.
I was getting the same error on a website project targeted for 4.6.2 that was referencing some older libraries, re-targeted it back to 4.5.1 and that resolved the error. I immediately re-targeted back to 4.6.2 and did not encounter the error again.
I had this same issue, but none of the answers here solved it, but did point me in the right direction. I think I didn't update the .NET version on my machine to the newer one. After installing it, I rolled back the targeted framework (as was suggested), retargeted the newer framework, and did a few extra things also:
Reinstalled ALL packages by running this in the package manager:
update-package -reinstall
I also compared my project to one that was working for 4.5 and did this:
Opened my project file and removed all "BCL" related elements.
Uninstalled all "BCL" packages in the NuGet package manager for the project (guess it's not needed moving to 4.5+...?)
Removed an old package version of System.Net.Http, which did not get updated for some reason (see web.config - versions should show oldVersion="0.0.0.0-4.0.0.0" newVersion="4.0.0.0").
Have to restart VS.
Rebuild solution.
Error is now gone. ;)
One other thing I did to resolve some other errors was to clear the component cache by deleting all files in here:
C:\Users\{USERNAME}\AppData\Local\Microsoft\VisualStudio\14.0\ComponentModelCache\
[rant] Wasted a whole day with all this. Thanks to MS for stealing one more day of my life fixing senseless issues that should never be. Every time I upgrade I always get a wonderful surprise, and a lovely game of fix the red herring. Would it not hurt to detect these conflicts for those upgrading old projects? Perhaps better error traces when things go wrong? I doubt it would be that difficult. Perhaps even something like AsmSpy, but more advanced, built in to VS? [/rant]
Saw this in VS 2019. I excluded and re-included the problematic file (in my case _Layout.cshtml) and that fixed the problem.
I got this error suddenly a couple days after updating to VS2015.3 using 'traditional' MVC app (not new .NET Core / vNext app).
Turns out this error can be a complete red herring.
Make sure:
You haven't got any other errors at all
You've checked the output window for any errors that don't show in the 'Output' window.
Make sure you don't have any conflicting references
In my case I had a typescript error that was causing an error and for some reason triggering this weird 'red herring' dynamic error too.
My fix was to go into the .csproj file and update the typescript tools version to 1.8 (need to unload project and edit by hand). As I said this is unrelated to the error, but I mention the specifics because someone else may end up with this same problem.
I believe that 1.7 didn't accept 'None' for the typescript module system whereas 1.8 does, hence the error.
Adding a reference to System.Dynamic.Runtime did it for me.
I hesitate to write this as an answer, but for me the error appeared in a .cshtml file. I closed the page, rebuilt, and the error vanished. Always best to try the simple things first.
I had the same error, there were just 2 unused tables of my databaseset that I had to delete. I wonder why it worked when I manually change sth in an auto-generated code work but after deleting, it worked.
So be aware that such inconsistencies can also cause this error.
My solution was to correct the version of MVC in web.config under Views folder. E.g. the project referenced MVC assembly version 5.2.2.0 but in the Views/web.config file was version 5.2.4.0 (see image).
Image
Tried a few other answers with no luck, but the overall consensus appears to be that this some sort of issue with cached build artifacts or compiler state or something. Here's what worked for me:
Delete the problem .cshtml file, watch error disappear
Open source control and revert the deletion
This error will come because of the different versions of your Sitecore.Web.Mvc.Dll in solution reference folder(Project name->References->Sitecore.Web.Mvc->right click and check properties) and the version of Sitecore.Web.Mvc.Dll in Web.Config in views Folder.
For solving this error you have to make sure that the version of Sitecore.Web.Mvc.Dll is same in both folders.
Thanx.
For my case, I fixed to run the command line "update-package -reinstall" on the Package Manager Controler.
My problem was in the _Layout.cshtml.
None of the solutions above did the trick for me. I am using VS2017 for this project, upgraded an ran into the same message.
I had commented out a 2 lines in 1 comment #* *#
My solution was to comment out each line separately. What a mystery!
A few hours lost on this.

ANTLR C# Can't find 'IAstRuleReturnScope'

I have downloaded the csharp grammar project from here http://antlrcsharp.codeplex.com/releases/view/47523, and it runs fine.
But when I add 'output=AST' to the grammar, I get a TON of errors:
I am admittedly new to ANTLR, so I am not sure how to proceed at this point. I would have assumed this type would have existed in the antlr csharp runtime dll, but obviously not. Has anyone come across this problem before?
I ran into this migrating from a v3.2 script generating from the Java tool to using v3.4 with the dotNet build tools.
I was able to figure out (thx to the documentation that comes with the .net VS integration) that the problem with not getting the right return type was because a class is only generated if you have a return type on the rule. Adding a dummy integer return type to my rules that had no return value cleared that up.
There is a discussion of the rule returns in the C# generator and target in the documentation from the C# target page at antlr, follow the link at the top of the page and check out section 4.1.1 "Return values"
About a year ago I did a project with Antlr and ran into an issue where I got tons of errors. As odd as it sounds but by using an older runtime I got it to work. I think I used a dll that had been compiled for the 2.0 .Net Framework.
I do not remember exactly what the error was or what had actually caused it. All I remember is that it solved the issue. I have no idea if this will help in your situation but it's worth a shot if you are stuck.
You are not the first person to have this problem. The patch at https://github.com/antlr/antlr/pull/1 addresses it by providing the missing file. Include it in your source and recompile.

XNA - Missing Namespace for Video and VideoPlayer?

Today I tried to include some videos for cutscenes but I failed on even getting the variables recognized.
If I try to access Microsoft.Xna.Framework.Media.Video or Microsoft.Xna.Framework.Media.VideoPlayer it is just missing.
.Media exists but Video/VideoPlayer is just not there
I also can't use "using Microsoft.Xna.Framework.Media;".
If I copy the exact same project to the example project on the Microsoft website it recognizes "Video" and "VideoPlayer" but of course everything else will not work cause of the wrong namespace, missing content and all that stuff.
I already reinstalled the complete SDK with XNA and .NET Frameworks but it still doesn't work.
If I create a new project and copy it there it doesn't work too, did I miss something?
Do I need something else except using Microsoft.Xna.Framework.Media.Video?
I compared the full projects but couldn't find any difference at all.
You are missing a reference to Microsoft.Xna.Framework.Video.dll.
That is where those two classes are located.
Sorry for late answer but this could be helpful..
You can try to install nuget package directxtk_desktop_2015 this will fix issue.
here is reference link.
It looks like your project is missing a reference to the assembly: Microsoft.Xna.Framework.dll.
UPDATE:
Kendall Frey is right, although Microsoft says in the documentation that the Video and VideoPlayer classes are in Microsoft.Xna.Framework.dll, this information is incorrect and these classes are really in Microsoft.Xna.Framework.Video.dll

Categories