At first I thought this was possibly because the server you're deploying to didn't have .NET Framework 3.5SP1 installed and only .NET 3.5RTM.
However, upon checking a .NET 3.5 RTM System.ServiceModel.Web.dll
assembly I see that the System.Runtime.Serialization.Json.DataContractJsonSerializer
is actually defined.
The compiler warning CS1684 suggests that there is a System.ServiceModel.Web.dll
assembly in the server's GAC, but one that doesn't have the System.Runtime.Serialization.Json. DataContractJsonSerializer
defined.
So things I would check:
Check that the deployment server is running at least .NET 3.5 RTM and that a beta or release candidate isn't in use or hasn't been left over.
In Visual Studio 2008 make sure you select a "Target Framework" of .NET 3.5 in the project properties.
One final check you could do to see if the problem lies with the server's framework install is to knock up a simple application to consume the DataContractJsonSerializer
directly. There's an example on the MSDN documentation page for the class:
DataContractJsonSerializer Class (MSDN)
As a last resort, if the server is under your control then I'd uninstall .NET Framework 3.5 and then re-install from:
Microsoft .NET Framework 3.5 Service Pack 1 (Full Install)
Update:
As per your comments:
If you're running a beta of 3.5 then chances are that DataContractJsonSerializer
isn't in the System.ServiceModel.Web.dll
assembly.
I seem to remember back around the CTP, betas and release candidates there were late breaking changes in this area. I vaguely remember the DataContractJsonSerializer
was one of these late additions/changes due to the increased popularity of JSON and community pressure. My memory is a bit vague but it rings a bell.
To replace the DLL you need to unregister the current version from the GAC then register the RTM one using the GACUTIL.exe
tool. I wouldn't advise mixing RTM and beta bits, you're leaving yourself open to unpredictable behavour.