Can't test csc build command because it exceeds command prompt max length


I'm trying to investigate an odd issue where our build is failing on the team city agent but not locally on out dev machines. The error we see is something like 

The type or namespace name 'MyClass' does not exist in the namespace 'MyNamespace'

When i copy the Csc.exe command that is being used i can't run it manually because it exceeds the max length allowed in command prompt. Firstly would team city also hit this problem? could this be the cause? if not how can i run this command to test it?

It seems like the command is so long due to lots of /resource:path arguments. Why does team city pass so many resource args anyway? doesn't the csproj contain a reference to them?

Comment actions Permalink

Hello Ryan,

Please use the following guildeines to investigate the issue. If you think the that issue ison Teamcity side, then please attach screenshot of the build step settings and full buid log? 

Comment actions Permalink

Hi Alina, 

I am following those steps, the problem however is when i copy the build command from the team city logs the length of the command exceeds the max input length of cmd.exe

This page suggests that it is 8191 characters. The command generated is 21648 characters. So when i try to paste it into command prompt it truncates the command. 

The command looks something like this 


C:\Program Files (x86)\MSBuild\12.0\bin\Csc.exe /noconfig /unsafe- /checked- /nowarn:1701,1702 /nostdlib+ /platform:anycpu32bitpreferred /errorreport:prompt /warn:4 /baseaddress:285212672 /define:TRACE /highentropyva+ .....

with multipe /reference:C:\TeamCity\work\2fd71d00529f4679\app\Dependancy.dll and /resource:obj\Release\SomeFile.resources parameters that make up most of the command. (removed due to this being a public forum)

What i'm trying to understand is if command prompt has this length limit how is team city even running the command or is this the under lying problem?


Comment actions Permalink

Ok so i rolled back some of my changes because the build was working at one point. I was trying to get the AssemblyInfo.cs files updated with the current build number So i added the Build feature "AssemblyInfo Patcher". When i disabled this feature the build passed and didn't produce this error. Any idea why this might be causing the problem?


Please sign in to leave a comment.