Type or namespace name does not exist
I have a WCF Data Service project built with Visual Studio 2010, which was working fine. All of a sudden, it didn't compile anymore. It was giving me messages like:
Error 7 The type or namespace name 'Services' does not exist in the namespace 'System.Data' (are you missing an assembly reference?) C:U...sVisual Studio 2010Projects...DataService.cs ...
Error 8 The type or namespace name 'Linq' does not exist in the namespace 'System' (are you missing an assembly reference?) DependencyResolver.cs 3 14
Error 10 The type or namespace name 'Web' does not exist in the namespace 'System.ServiceModel' (are you missing an assembly reference?)
Error 12 The type or namespace name 'DataService' could not be found (are you missing a using directive or an assembly reference?)
How can I fix it?
I have had the same problem, and I had to set the "Target Framework" of all the projects to be the same. Then it built fine. On the Project menu, click ProjectName Properties. Click the compile tab. Click Advanced Compile Options. In the Target Framework, choose your desired framework.
I had an issue with System.Linq not being recognized. The using
statement had a red squiggly, etc. The way I solved it was to change my website to target dotnet 3.5, then switch back to the original targeted framework (4.0 in my case).
I faced the same issue with an ASP.NET MVC site when I tried to use LINQ to SQL. I fixed the problem by:
Solution Explorer -> References -> Right-click on System.Data.Linq -> Copy Local (True)
链接地址: http://www.djcxy.com/p/64320.html下一篇: 类型或名称空间名称不存在