Reputation: 30111
I'm messing around with some JSON and I'm trying to use the JavascriptSeralizer Class but I cannot for the love of god find a link to find where to add the assembly to my project. Someone help please!
Update I'm using .NET 4.0 and its not in the .Net tab when you right click on references -> add reference in the solution explorer of Visual C# 2010.
Upvotes: 48
Views: 163783
Reputation: 2033
I had this issue when converting an older project to use a new version of Visual Studio. Upon conversion, the project target framework was set to 2.0
I was able to solve this issue by changing the target framework to be 3.5.
Upvotes: 0
Reputation: 442
Your project is mostly likely targetting .NET Framework 4 Client Profile. Check the application tab in your project properties.
This question has a good answer on the different versions: Target framework, what does ".NET Framework ... Client Profile" mean?
Upvotes: 4
Reputation: 1264
I had this problem myself. Most of the information I could find online was related to people having this problem with an ASP.NET web application. I was creating a Win Forms stand alone app so most of the advice wasn't helpful for me.
Turns out that the problem was that my project was set to use the ".NET 4 Framework Client Profile" as the target framework and the System.Web.Extensions reference was not in the list for adding. I changed the target to ".NET 4 Framework" and then the reference was available by the normal methods.
Here is what worked for me step by step:
Upvotes: 64
Reputation: 9664
EDIT:
The info below is only applicable to VS2008 and the 3.5 framework. VS2010 has a new registry location. Further details can be found on MSDN: How to Add or Remove References in Visual Studio.
ORIGINAL
It should be listed in the .NET tab of the Add Reference dialog. Assemblies that appear there have paths in registry keys under:
HKLM\Software\Microsoft\.NETFramework\AssemblyFolders\
I have a key there named Microsoft .NET Framework 3.5 Reference Assemblies with a string value of:
C:\Program Files\Reference Assemblies\Microsoft\Framework\v3.5\
Navigating there I can see the actual System.Web.Extensions dll.
EDIT:
I found my .NET 4.0 version in:
C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\System.Web.Extensions.dll
I'm running Win 7 64 bit, so if you're on a 32 bit OS drop the (x86).
Upvotes: 31
Reputation: 499002
The assembly was introduced with .NET 3.5 and is in the GAC.
Simply add a .NET reference to your project.
Project -> Right Click References
-> Select .NET
tab -> System.Web.Extensions
If it is not there, you need to install .NET 3.5 or 4.0.
Upvotes: 4