deletion of dependencies in /bin with sln2008

Just new to TeamCity, but I couldn't find an answer to this in the forum

I've run a sln2008 build runner, and I have a web app with 26 dependency dll:s in the /bin folder. Only 6 of these are actually referenced by the web application. But the others are needed by those 6. In other words, we're talking about dependencies of dependencies. But...every time a build is run, sln2008 seems to remove a lot of these files so that the application can't run. Why?? Can I prevent this?

Extraction from build log:

[12:40:56]: [Project "UnitTestExample.sln" (Rebuild target(s)):] Project "UnitTestWeb.csproj" (Rebuild target(s)):
[12:40:56]: [Project "UnitTestWeb.csproj" (Rebuild target(s)):] Deleting file "C:\TeamCity\buildAgent\work\be765d9d557b8e9\UnitTestWeb\bin\UnitTestWeb.dll".
[12:40:56]: [Project "UnitTestWeb.csproj" (Rebuild target(s)):] Deleting file "C:\TeamCity\buildAgent\work\be765d9d557b8e9\UnitTestWeb\bin\UnitTestWeb.pdb".
[12:40:56]: [Project "UnitTestWeb.csproj" (Rebuild target(s)):] Deleting file "C:\TeamCity\buildAgent\work\be765d9d557b8e9\UnitTestWeb\bin\DependencyOfDependency.dll".
...more of these ...
[12:40:56]: [Project "UnitTestWeb.csproj" (Rebuild target(s)):] Deleting file "C:\TeamCity\buildAgent\work\be765d9d557b8e9\UnitTestWeb\obj\Release\ResolveAssemblyReference.cache".
[12:40:56]: [Project "UnitTestWeb.csproj" (Rebuild target(s)):] Deleting file "C:\TeamCity\buildAgent\work\be765d9d557b8e9\UnitTestWeb\obj\Release\UnitTestWeb.dll".
[12:40:56]: [Project "UnitTestWeb.csproj" (Rebuild target(s)):] Deleting file "C:\TeamCity\buildAgent\work\be765d9d557b8e9\UnitTestWeb\obj\Release\UnitTestWeb.pdb".
[12:40:56]: [Project "UnitTestWeb.csproj" (Rebuild target(s)):] Successfully cleaned the output for 0 EDMX files.
[12:40:56]: [Project "UnitTestWeb.csproj" (Rebuild target(s)):] Processing 0 EDMX files.
[12:40:56]: [Project "UnitTestWeb.csproj" (Rebuild target(s)):] Finished processing 0 EDMX files.
[12:40:56]: [Project "UnitTestWeb.csproj" (Rebuild target(s)):] C:\Windows\Microsoft.NET\Framework\v3.5\Csc.exe /noco

Comment actions Permalink

TeamCity solution build runner (sln2008) is just an msbuild call to build your solution. You may simply try it from command line. For that, could you please run
msbuild.exe <soluiton.sln> /t:Rebuild

Does this commandline works for you? Any way, in VS you may set explicit dependiencies between projects to enforce them to be built. But you do not need to specify any transitive dependiencies explicitly.


Comment actions Permalink

Hello and big thanks for a very fast reply!

Actually I tried running msbuild, both locally and manually on the TeamCity server on the path


where the project is.

Works perfectly. No dlls are removed. Strange huh? So why does sln2008 remove them? What's the exact invocation of msbuild by sln2008? Is anything else run as part of the process?

Comment actions Permalink

TeamCity generated small wrapping script that includes you script. What is done are TeamCity specific tasks definitions.
MSBuild is started with a list of arguments containing some number of msbuild properties.

Could you please attach a build log for that build.

What is the user account used to run build agent?

Do you use mapped drives?


Comment actions Permalink

I'll attach the build log - one example of a dll that is deleted and not directly referenced is log4net.dll (which is referenced by the assemblies actually referenced)

I've tried different user accounts - starting with Network Service and then my own account with administrative priviliges. The log is from running Network service.

If you by mapped mean network share or similar (i.e. Map Network drive in Windows Explorer) - then no. It's on the local C drive.

Comment actions Permalink

You've doing rebuild for configuration Release. Could you please check there is no 'Clean' targets that removes all files from the folder?


Please sign in to leave a comment.