TFS build failing. Unresolved references to files that are in source control

15,769

This could be an issue on how the working folders are set up in your build definition (under Workspace).

If I understood your path-scheme correctly, setting the paths as follows should work:

Active |$/TeamProject/Root/BaseBinRefs/                    |$(SourceDir)\Root\BaseBinRefs
Active |$/TeamProject/Root/Services/AssemblySolutionFolder/|$(SourceDir)\Root\Services\AssemblySolutionFolder

whereas, for example, this would cause trouble:

Active |$/TeamProject/Root/BaseBinRefs/                    |$(SourceDir)\
Active |$/TeamProject/Root/Services/AssemblySolutionFolder/|$(SourceDir)\
Share:
15,769
ChrisBint
Author by

ChrisBint

Updated on July 19, 2022

Comments

  • ChrisBint
    ChrisBint almost 2 years

    I have a build that works fine locally, however, will not build within our TFS environment.

    I get the following error;

    C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Microsoft.Common.targets (1578): Could not resolve this reference. Could not locate the assembly "Assembly.Services.Common". Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors.

    The assembly in question is checked into TFS and is in the following location;

    /Root/BaseBinRefs/Assembly.Services.Common.dll

    It does not have any external references outside of the .net framework.

    The project that is failing to build is in the following location in TFS

    /Root/Services/AssemblySolutionFolder/AssemblyThatIsFailing

    The assembly is referenced in a project within the solution and the HintPath to the assembly appear to be correct;

       <Reference Include="Assembly.Services.Common, Version=1.0.0.0, 
          Culture=neutral, processorArchitecture=MSIL">
          <SpecificVersion>False</SpecificVersion>
          <HintPath>..\..\..\BaseBinRefs\Assembly.Services.Common.dll</HintPath>
        </Reference>
    

    As said, it builds locally and I can see no reason why it should fail within TFS. the caveat to that is that I am new to TFS in general and still trying to integrate the first of our projects into this environment.

    Update 1

    Using ProcessMonitor, I see TFS attempting to load the file from;

    C:\Builds\1\Root\BaseBinRefs\Assembly.Services.Common.dll

    Which does not exist, but is correct in the relative sense. Now, when I look in the Sources directory, I see BaseBinRefs, with Assembly.Services.Common.dll included, so it has downloaded them (I added the BaseBinRefs to the build definition)

  • Jeremy Thompson
    Jeremy Thompson over 11 years
    I was just going to add use the GAC to get around this issue.
  • pantelif
    pantelif over 11 years
    @Jeremy: In my opinion, inserting into the GAC a source-controlled assembly is not a good idea.
  • ChrisBint
    ChrisBint over 11 years
    @pantelif As above, I already added the working folder and it is correct.
  • pantelif
    pantelif over 11 years
    That's very interesting. Open with Visual Studio the SLN that resides under C:\Builds\1. I expect VS2010 to correct the ref & your solution should compile. Now take this AssemblyThatIsFailing.csproj and compare it to the one checked in - this might provide with a hint on the issue.
  • ChrisBint
    ChrisBint over 11 years
    Strangely enough, the solution I implemented (temporarily) was to have a local binrefs folder and although this worked, I preferred to have the the initial problem resolved. I moved everything back and it is now all working. I am going to mark this as the correct answer is I believe it was something to do with this all along, although as shown above, I had added the paths correctly.