6

I have an ASP.net MVC 3 project. We're using TeamCity, and up until now everything has checked in fine. All of a sudden today, I did a checkin, and the TeamCity build failed. It said I was missing a using directive or assembly reference and threw a compilation error.

The project on my local machine builds successfully. I rebuilt it several times to make sure. I checked the reference and it's there. I checked the .csproj file and it has the reference there too. I checked bin; it's there. I even RDPed into the server where our site is deployed and checked the bin there, and the dll file is there too.

I don't understand why it's not working, I haven't changed anything in the particular files it says are missing the assembly reference in weeks, I had a successful checkin on TeamCity yesterday, the dll file exists everywhere it's supposed to, and my project builds. I even did a hard reset to the last commit I made that checked in successfully, added my changes back in (which had nothing to do with the reference problem, all my changes were in a .js file), and checked that in, but I got the same compilation error.

Does anyone have any idea what's going wrong, or at least what I might try to resolve this?

edit: There are no path files being used here, the file in question is a .dll file, which I added by clicking "Add reference" on the project. I checked the Github repository and the .dll file is in the bin folder

Erica Stockwell-Alpert
  • 4,624
  • 10
  • 63
  • 130
  • 2
    Sounds to me like a DLL got removed from your repository but is still present on your local machine. – iamkrillin Aug 15 '14 at 19:30
  • How can I fix this? I have it on my local machine and I've pushed to master, but clearly that hasn't worked. What else would i do? – Erica Stockwell-Alpert Aug 15 '14 at 19:33
  • If the file it says is missing is present in your VCS it might be a path issue. For example, if your project has the file at C:\\.dll (note: absolute path) instead of \.dll (note: relative path) it likely wont work when teamcity tries to run the build – iamkrillin Aug 15 '14 at 19:37

4 Answers4

8

iamkrillin got me thinking that maybe it was a path issue, so I opened up the csproj file and noticed that the format of the reference to "missing" file was different from all the others around it:

<Reference Include="Ektron.Newtonsoft.json">
  <HintPath>..\..\Custom\bin\Ektron.Newtonsoft.json.dll</HintPath>
</Reference>

// THE "MISSING" FILE
<Reference Include="Smdg.Utils, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
  <SpecificVersion>False</SpecificVersion>
  <HintPath>..\NEHGS\bin\Smdg.Utils.dll</HintPath>
</Reference>

I checked the Custom\bin folder and sure enough the .dll file was there (though it also existed in NEHGS\bin), so I got rid of the SpecificVersion tag and changed the path to the Custom folder. TeamCity was able to check it in.

Why it suddenly broke when it's been working for the past 2 months, I have no idea.

Community
  • 1
  • 1
Erica Stockwell-Alpert
  • 4,624
  • 10
  • 63
  • 130
2

I had this just because of not storing NUGET packages at VCS (GIT).

So there is the need to do the restoration of NUGET packages, just before a build step.

https://blog.jetbrains.com/teamcity/2013/08/nuget-package-restore-with-teamcity/

Motlicek Petr
  • 767
  • 9
  • 10
1

I had the same issue of my TC build suddenly being unable to find an assembly. I solved it by checking in the paths as well. My assembly did not have a tag. Once I added the tage with the path to the dll, TC was able to build successfully

Alexander Burke
  • 534
  • 7
  • 22
0

I hope this helps someone out there, in my case I had to check in the folders that had the reference dll/nuget packages. Note that I had already committed the project but for some reason 'SVN' did not check in/ commit the (local) folders that had the dll/ nuget packages so I had to go to the folders and check them in.

Ask
  • 1,001
  • 1
  • 10
  • 11
  • 1
    TeamCity should restore the missing NuGets on each build. NuGet binaries should not be version controlled. – tkit Oct 05 '18 at 09:17