How to fix "the command line is too long" when compiling licx (lc.bat) with Mono xbuild

1.5k views Asked by At

I have a pretty large solution. The parent project that loads everything has lots of references and what not to make sure everything is being loaded. I also have a licx file for a third party dll we use. This all works fine in visual studio.

However when compiling the same solution with xbuild (mono), the lic.bat command fails because "the command line is too long".

Tool C:\PROGRA~2\MONO-3~1.10\bin\lc.bat execution started with arguments: --complist=my.licx --target=MyExe.exe --load=C:\PROGRA~2\MONO-3~1.10\lib\mono\4.5..\xbuild-frameworks.NETFramework\v4.0\RedistList........\4.0\System.dll --load=C:\PROGRA~2\MONO-3~1.10\lib\mono\4.5..\xbuild-frameworks.NETFramework\v4.0\RedistList........\4.0\System.Configuration.Install.dll --load=C:\PROGRA~2\MONO-3~1.10\lib\mono\4.5..\xbuild-frameworks.NETFramework\v4.0\RedistList........\4.0\System.Data.dll --load=C:\PROGRA~2\MONO-3~1.10\lib\mono\4.5..\xbuild-frameworks.NETFramework\v4.0\RedistList........\4.0\System.Management.dll --load=C:\PROGRA~2\MONO-3~1.10\lib\mono\4.5..\xbuild-frameworks.NETFramework\v4.0\RedistList........\4.0\System.ServiceModel.dll --load=C:\PROGRA~2\MONO-3~1.10\lib\mono\4.5..\xbuild-frameworks.NETFramework\v4.0\RedistList........\4.0\System.ServiceProcess.dll --load=......\Common\log4net.dll --load=C:\PROGRA~2\MONO-3~1.10\lib\mono\4.5..\xbuild-frameworks.NETFramework\v4.0\RedistList........\4.0\System.Configuration.dll

...................

......................

.........................

many many more lines of different dlls with really long paths in the solution

...................

then it fails with that command

Short of moving my licx file to another project to try and reduce the references that this licx stuff, is here a way to tell mono not to include certain projects or to pass arguments through a different mechanism.

Follow up question I guess a follow up question is why lc.bat has to reference every dll. Doesn't it only care about the licx file and the dlls referenced in there?

1

There are 1 answers

2
Tony On

If you can't use a config file, do a drive substitution at the command prompt or inside your batch file for the path most used in your command line.

Subst K: C:\PROGRA~2\MONO-3~1.10\lib\mono\4.5..\xbuild-frameworks.NETFramework\v4.0\RedistList........\4.0

Then replace all paths in your command with K: ... So,

--load=C:\PROGRA~2\MONO-3~1.10\lib\mono\4.5..\xbuild-frameworks.NETFramework\v4.0\RedistList........\4.0\System.dll 

becomes

--load=K:\System.dll 

etc.

Make sure to use the proper path instead of the (...) abbreviated ones.