[Solved] The type or namespace name ‘Service’ does not exist Error

The reason for this exception may be that the corresponding assembly is not introduced into the project. Generally speaking, the problem is solved after the required assembly is introduced. Sometimes there is a strange problem. For example, project B is a class library. Project a refers to the class of project B, such as userservice. Project B is also introduced into the reference of project A. However, when compiling in project a, an error is reported, saying that the type or namespace name ‘userservice’ does not exist in the namespace ‘xxx’ (are you missing an assembly reference?)

Now, for example, is there anything related to warning

The referenced assembly ” XXX.Service.dll ” could not be resolved because it has a dependency on ” System.ServiceModel.Web , Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35″ which is not in the currently targeted framework “.NETFramework,Version=v4.0, Profile=Client”. Please remove references to assemblies not in the targeted framework or consider retargeting your project.

That is to say, because the Framework version used by project a and project B is different, the class of a cannot be used in project B. At this point, as long as the Framework version of the project is reset to make the two projects consistent, the problem is solved.

Read More: