问题
i get the following error when trying to compile my asp.net site after updating the project from vs2008 to vs2010
The type or namespace name 'Syndication' does not exist in the namespace 'System.ServiceModel' (are you missing an assembly reference?)
I have the asp.net site targeting 3.5 framework (as it did in vs2008) I also added a reference to System.ServiceModel.Web
I also have these using statements at the top of my class: using System.ServiceModel; using System.ServiceModel.Description; using System.ServiceModel.Syndication; using System.ServiceModel.Web;
The last 2 complain with the error above, commenting them out produces errors (cannot find WebGet, etc.) like it flipflops.
Anyone have any ideas?
回答1:
I got this working in .NET 3.5 by adding the Web DLL, thanks to the post below.
DOTNET 3.5: add a reference to the System.ServiceModel.Web.dll
DOTNET 4.0: add a reference to the System.ServiceModel.dll
StackOverflow Post
回答2:
For me it turned out to be the following line:
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
it should have been
<assemblyBinding appliesTo="v2.0.50727" xmlns="urn:schemas-microsoft-com:asm.v1">
I had many other projects in the solutions all based off the same thing - no idea how that went missing but adding it in solved the problem.
回答3:
Try deleting any references in question and then re-adding them afresh and compile. Does the same happen?
回答4:
remembered a kinda similar thing in the past, i fixed it by continuously changing the target between 2,3,3.5 until it worked - yes you heard me right. My guess is it took a time or two from one version to the next for it to self-fix the config file.
回答5:
If you get this in Visual Studio 2010, I found cleaning your solution, closing Visual Studio and restarting it solved the intellisense issue.
来源:https://stackoverflow.com/questions/2667985/the-type-or-namespace-name-syndication-does-not-exist-in-the-namespace-system