Building win32 application of unity3d failes with teamcity plugin

I have a unity3d project using imported csv-files. I can build it on local pc without any problem. When I try to build it with the plugin for teamcity, i get this error:

Type System.IO.DirectoryInfo' does not contain a definition for GetFiles’ and no extension method GetFiles' of type System.IO.DirectoryInfo’ could be found (are you missing a using directive or an assembly reference?)

System.IO.File' does not contain a definition for ReadAllText’

I tried to copy some csv-files on the server in the certain file before building unity, but the build failed again. I use a Windows-Server, of course.

Thx for your help in advance!

My guess would be that you are using Unity 5.3 or older and that your build target is set to WebPlayer. Because of that Unity is using a limited version of mono which does not include access to Files.

To test if this is your issue, you can test by switching the Editor to the WebPlayer build target on your local PC. If you see the same errors, it’s very likely that this is the problem.

To fix it you need to pass the BuildTarget.StandaloneWindows target to the BuildPipeline.BuildPlayer function when making your build.