Adding System.Web.Script reference in class library
Asked Answered
C

3

132

I am currently moving code from my app_code folder to a class library. I have tagged several methods with [System.Web.Script.Serialization.ScriptIgnore] attributes. My class library cannot see this namespace. My add references dialog cannot see this namespace. How do I properly use this tag from a class library?

Here is the error: The type or namespace name 'ScriptIgnoreAttribute' could not be found (are you missing a using directive or an assembly reference?)

Concierge answered 20/7, 2009 at 22:27 Comment(0)
S
284

The ScriptIgnoreAttribute class is in the System.Web.Extensions.dll assembly (Located under Assemblies > Framework in the VS Reference Manager). You have to add a reference to that assembly in your class library project.

You can find this information at top of the MSDN page for the ScriptIgnoreAttribute class.

Salesmanship answered 20/7, 2009 at 22:31 Comment(6)
Nice one. System.Web.Script.JavaScriptSerializer is also in this assembly.Unflinching
I love how the System.Web.Script.Serialization is in the System.Web.Extensions library.Innerve
it is not available in asp.net2Wynd
Make sure you are using .NET framework 4 not .NET Framework 4 client profile as the target framework, or System.Web.Extensions will not appear in the Add References dialog.Duplicature
It's the year 2017, we're still in VS 2005 and this answer just saved my bacon. To infinity, and beyond!Epoxy
How can i use serailizer & deserializer in JScript.NET?Oblige
I
19

You need to add a reference to System.Web.Extensions.dll in project for System.Web.Script.Serialization error.

Inalterable answered 22/3, 2016 at 13:2 Comment(0)
M
0

I have been testing for .Net Framework V4.7 and have found the System.Web.Script namespace from the reference System.Web.Extensions

enter image description here

Merilee answered 23/1, 2023 at 16:18 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.