Cannot find the System.Web.Script.Service namespace error after upgrading to Visual Studio 2010

I just upgraded the VS 2008 project to VS 2010, converting the project, but saving the target as .NET 3.5 (SP1 installed). My project worked without problems in VS 2008 on another machine.

I added links to System.Web.Extensions.dll, but I still get the following errors from the code in the App_Code folder:

1) Cannot find the namespace System.Web.Script.Service.

2) The type 'System.Web.Script.Services.ScriptService' is not defined.

3) The type 'System.Runtime.Serialization.Json.DataContractJsonSerializer' is not defined.

Does anyone have any idea what the problem might be, since I'm pretty dumb ?: (

+7
json visual-studio-2010
source share
5 answers

There seems to be a bug from Microsoft, where the Target Framework for v3.5 in VS2010 is the v3.0 GAC! Moving problem builds to the v3.0 folder seems to be starting to solve the problems, but a little messy. I think I'll wait for Microsoft to get the correct fix for VS 2010!

http://www.cnblogs.com/dudu/archive/2010/06/24/1764549.html

Google translate helps with this link!

More information about the assemblies copied to the v3.0 folder from the v3.5 folder, as a workaround for this VS 2010 error:

http://forums.asp.net/p/1569744/3942724.aspx

If someone else encounters this problem and wants to track / vote on the status of this error with Microsoft: https://connect.microsoft.com/VisualStudio/feedback/details/570557/targeting-net-framework-3-5-actually -targets-3-0-gac

Update. Microsoft published the following patch for the bug report that I raised:

To create a target site on 3.5, add the compiler tag to the web.config file, as I insert below, so compiling the language will select the correct version of vbc.exe. You can create a new website 3.5, and by default web.config has those tags that you can link to.

<system.codedom> <compilers> <compiler language="vb;vbs;visualbasic;vbscript" extension=".vb" warningLevel="4" type="Microsoft.VisualBasic.VBCodeProvider, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <providerOption name="CompilerVersion" value="v3.5"/> <providerOption name="OptionInfer" value="true"/> <providerOption name="WarnAsError" value="false"/> </compiler> </compilers> </system.codedom> 
+5
source share

In Visual Studio 2012, be sure to add a link for System.Web.Extensions , as this is the one that contains System.Web.Script.Serialization .

+15
source share
  • Check the assembly of web.config entries.

  • Test your .NET Framework target in your Visual Studio 2010, by default 4.0.

  • Check IIS, make sure you use the appropriate structure for your site. The new version of .NET 4.0 may change the default default platform to 4.0.

+1
source share

I solved a similar problem by changing the target structure of my site from 3.5 to 4.0 and will return to 3.5 again.

As a result, many additions to my web.config file appeared, which will make Visual Studio easier to support my project.

I never upgraded my project to Visual Studio 2010, but it was an older aspx website, and this may have been the first time it has been open since VS 2010.

+1
source share

I also resolved a similar problem by changing the target site structure from 3.5 to 4.0 and will return to 3.5 again.

0
source share

All Articles