问题
I have a two Visual Studio 2010 solutions - one contains 4 files in a class project, the other has links to those files via the "Add as Link" (also in a class project). These solutions both build and run on my machine without any issues.
I have checked these solutions into TFS and created a build definition which is configured to build both of them (the one with the actual files first if that matters).
However, when I run the build it fails saying that "The type or namespace name 'xLinkedFileClassx' could not be found (are you missing a using directive or an assembly reference?)" for each of the linked files classes in the various locations they are referenced (no other errors are shown).
Looking at the build folder on the Build Server these (C:/Builds/...) these files do not exist. How do I get TFS to cope with these linked files?
回答1:
Check the build definition workspace, are you pulling those files down to the build server? Also make sure the workspace has the same relative path as on your desktop
回答2:
Well it seems I actually had some errors in my code and it manifested itself into this obscure bug!
In my configuration I am building certain projects in Release and not in Debug (and vice versa), but my Build Definition was set to Release and I was debugging it in Visual Studio in Debug so it wasn't spotting the errors. Fixing these bugs seemed to sort everything out.
Basically if you get any strange errors, make sure you build your projects in Debug and Release in Visual Studio just in case it is something hiding.
来源:https://stackoverflow.com/questions/12514803/tfs-2010-linked-files-failing-the-build