1

I have a solution file created with Visual Studio 2013. In it, I have a WCF project which contains some classes, and a Web Application project that calls some functions from WCF file. The web Application is able to reach it from codebehind of .aspx pages.

I have no issue building and compiling the WCF project. However, Visual Studio is unable to identify their classes.

In Web Application project, It underlines the using statement of the WCF class library in red, shows "Type or namespace could not be found" error. It takes the class from the file created by WCF automatically by Visual Studio.

WCF project is doing the same inside too. The two classes are in the same namespace, in fact, literally in same file together. Yet they can't see each other.

Long story short: I have 2 different projects in the same solution, they work and compile very well, but Visual Studio is unable to identify some of the classes in intellisense, even suggests to create new class. What would cause this?

EDIT: I removed the project from TFS, and the classes are colored properly, and so is the intellisense. Perhaps some files are locked as checked in, and causes trouble?

Pecheneg
  • 768
  • 3
  • 11
  • 27
  • 1
    Could you build your project successful in TFS? – PatrickLu-MSFT Mar 06 '17 at 05:46
  • Yes it's been built successfully. Yet it doesn't show the classes. – Pecheneg Mar 06 '17 at 08:19
  • 1
    Fisrt get latest of your project and solution. make sure the dlls download correctly in your local. If the issue still exists, maybe your **solution binding is broken.** try opening file -> Source Control -> (optionally) Advanced -> Manage Source Control. You can select project in your solution individually and then click the bind button on the toolbar to unbind and bind them to sourcecontrol manually. More detaisl refer http://stackoverflow.com/questions/358951/how-can-i-completely-remove-tfs-bindings – PatrickLu-MSFT Mar 06 '17 at 08:29

2 Answers2

1

Usually we do not suggest adding the BIN and the OBJ folders to source control, but do add the 3rd party dll's or using nuget package to handle them. Basically all that you need as input for your application is in source control, but the output of you application (the created dll's, pdb's etc) should not be included.

If you insist on this, first please double check you have add all related dlls in source control(check in them).

Then if your local build is successful and just the TFS build is failing then it is usually due to dll reference path issue. Make sure that the Dll is referenced as a relative path in the project file (.csproj).

Also give a try with adding the dll files into the bin folder where the builds located in TFS server. That .dll needs to be on whatever machine(build server) is running the build and the build definition needs to be pointing at that location.

Please take a look at this similar question: Namespace could not be found - building using TFS

Community
  • 1
  • 1
PatrickLu-MSFT
  • 49,478
  • 5
  • 35
  • 62
0

I unticked readonly option from my .sln file. I opened my .sln file with notepad and removed all the "GlobalSection" properties. (Related with TFS)

This solved the problem.

Pecheneg
  • 768
  • 3
  • 11
  • 27