Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I have a weird problem I just can't place.

I have a SP 2010 project which contains two sub-projects of type class library (FirstLib and SecondLib).

The project build fine, no errors whatsoever, but once I deploy to the server I get errors in VisualStudio's "Error List" window:

The type or namespace name 'X' could not be found (are you missing a using directive or an assembly reference?)

The type X is in FirstLib and is referenced from SecondLib. In the package manifest I specified that both be deployed to GAC and I can see they are there, but I still see that message, and I get it for every type in FirstLib that is used by SecondLib.

What's even weirder is that in the "Output" window I see this.

========== Build: 3 succeeded or up-to-date, 0 failed, 0 skipped ========== ========== Deploy: 1 succeeded, 0 failed, 0 skipped ==========

What could be the cause for this?

What should I check further?

share|improve this question
add comment

3 Answers 3

up vote 1 down vote accepted

I get this exact problem myself. I can't work it out either, but I have noticed that it will only occur when I have certain source code files open and active in Visual Studio (in your case it would be a code file from the SecondLib project), and it would only occur when trying to do a package or deploy action.

If you close the source files from SecondLib before doing a deploy the errors should go away.

share|improve this answer
    
I can reproduce your behavior. If I close all source files I get no error whatsoever. Is this a bug in VS2010? What could be the cause? –  JohnDoDo Nov 21 '11 at 11:27
    
Must be something like that. I mean, all projects actually compile sucessfully, and everything works ok, it's just that VS tell you something is wrong at the end. –  Paul Lucas Nov 21 '11 at 13:45
    
Have the same problem, nothing of these answers here works for me. I am using VS 2012. The question is 2 years old and nobody can solve this problem? –  Martin Feb 5 at 12:04
add comment

Make sure you've added other projects to main package. See http://www.sharemuch.com/2010/03/17/deploying-referenced-assemblies-with-your-vs2010-sharepoint-2010-wsp-solution/

Also you can open in Windows Exploerer - C:\Windows\Assembly and make sure your referenced dlls are deployed to GAC.

share|improve this answer
    
I'm already doing this. Assemblies are added to the package, I see them in the .wsp file and they are also deployed to GAC. The weird error still occurs. –  JohnDoDo Nov 21 '11 at 8:53
    
did you add a reference to both projects to your main project in VS? –  Yuri Leontyev Nov 21 '11 at 10:36
    
Yes, the main project references the libs. –  JohnDoDo Nov 21 '11 at 11:24
add comment

I had the same problem. (Re-)Built successful but deployment to SharePoint and manually packaging (Visual Studio -> Pubish) failed. I solved the problem by switching "Copy-Local" to false in every project (about 15 Class Library projects and three SharePoint Projects).

I think the problem is the linking between each project so Visual Studio can not resolve the dependencies in the right way.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.