CSC error CS2001: Source file 'myfile.cs' could not be found

Hi All,

I am using TeamCity Professional 6.5.1 (build 17834).

I have a number of builds which have starting getting the following compilation errors :

CSC error CS2001: Source file 'myfile.cs' could not be found

There may be several of these during a compilation.

They are builds which connect to TFS 2010 as the version control have a VCS checkout mode of 'Automatically on server' and have a Visual Studio 2010 Build Step.

Obviously for whatever reason some files are not ending up on the build agent hence the error but I cannot figure out why.

I have tried the 'Clean all files before build', 'Enforce overwrite all files' and have manually deleted the cache folder on the server.

Any help would be most appreciated.


Comment actions Permalink

Hi Kevin

Please check this file actualy exists in the repository, and you can access it by Team Explorer.
If so, please post teamcity-vcs.log


Comment actions Permalink

I am also facing similar issue.

In my case I am using link inside a project with relative path.


     <Compile Include="..\BuildResources\CommonAssembly.cs">






Following is the build error receiving from teamcity: 

  • CSC error CS2001: Source file 'C:\BuildAgent\work\12e5033e0ef0f0bf\TestApp.Data\..\BuildResources\CommonAssembly.cs' could not be found.

instead of including file from C:\BuildAgent\work\12e5033e0ef0f0bf\BuildResources\CommonAssembly.cs,   teamcity is trying to use location  'C:\BuildAgent\work\12e5033e0ef0f0bf\TestApp.Data\..\BuildResources\CommonAssembly.cs'


How we can fix this issue ? 


Please sign in to leave a comment.