views:

64

answers:

2

I am writing a WPF client that consumes services from an ASP web service (VS2010, .net 4.0). It was working just fine until yesterday when I suddenly get the above compiler error. Double-clicking on the error takes me to Reference.cs and highlights just about anything along the lines of:

[System.Runtime.Serialization.DataMemberAttribute(EmitDefaultValue=false, Order=2)]

(The 'Runtime' object is highlighted as not being in the MyAppNameSpace).

I've tried googling this and re-adding the service reference and re-adding the assemby reference but nothing works and I'm completely stuck. Reference.cs is automatically generated and I'm still relatively new to VS2010 so I'm not sure where to go with this.

Hoping someone here can point me in the right direction...?

A: 

Well, for the sake of anyone looking for an answer in future - I gave up trying to fix it and copied a backup of the project files over the existing ones and brought the changes since them in manually. That fixed the corrupt referencing issue.

Philip
A: 

Your problem is that you had defined a "System" namespace somewhere that the compiler and Intellisense were finding before the real "System". The solution is to remove the offending namespace, then clean and rebuild the project.

Ray Burns
Initially that's what I thought... but there was no such namespace in the project so I don't understand quite where the reference came from (I had not changed namespaces or anything for some time). In the end I fixed it by re-copying the old project .sln and proj files from a backup, which implies something bad had happened to the existing ones.
Philip
If you still have the corrupted proj files you might doing a diff between them and the ones you restored from backup. This should make it easy to see what changed. I would like to know, and I'm sure others would as well.
Ray Burns