5

I am developing a SharePoint 2013 solution using VS 2012, the solution has a licx file. I get a compile time error and a warning.

Error: The specified task executable "LC.exe" could not be run. The filename or extension is too long

Warning: The command-line for the "LC" task is too long. Command-lines longer than 32000 characters are likely to fail. Try reducing the length of the command-line by breaking down the call to "LC" into multiple calls with fewer parameters per call.

I have tried the lc.exe.config has <startup useLegacyV2RuntimeActivationPolicy="true"> I also tried moving the solution to "C:\", was earlier in the Projects folder.

I am still unable to resolve this error.

John Saunders
  • 160,644
  • 26
  • 247
  • 397
  • Seems this is to do with the Microsoft.SharePoint.dll, if I remove this reference from the project it compiles correctly. But I cannot do without the SharePoint API... – Kiran Srikanta Feb 07 '13 at 09:19
  • 5
    Possible duplicate of [LC.exe could not be run](http://stackoverflow.com/questions/11906118/lc-exe-could-not-be-run) – Lafexlos Nov 24 '15 at 07:11

5 Answers5

2

There is MS Support workaround:

when you build the project , delete the Licence file from the project everytime you get this error , just delete the licence file

https://connect.microsoft.com/VisualStudio/feedback/details/779433/lc-exe-task-command-line-too-long

zchpit
  • 3,071
  • 4
  • 28
  • 43
  • If you are about to copy paste your answer from another question about the same problem, think to yourself "should I post a duplicate answer on this duplicate question, or should I not answer but instead flag this question as duplicate" - and then pick the latter. Trying to keep SO clean, every bit helps. – Tim Nov 27 '15 at 14:24
  • This is not a valid workaround if the license component must run for licensing 3rd party components for example e.g. release builds. – Shiv Jul 28 '16 at 01:46
2

You will be able to save a lot on the path length by making a shortcut to the specific .NET version you use (in this case 4.5.2). Here are the steps;

  1. run command line as Administator
  2. Go to C:\ in command line
  3. mklink /J net452 "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5.2"
  4. Go to VisualStudio
  5. Open project properties
  6. Look into References tab
  7. Click on "Reference paths" button and add path "C:\net452"
  8. Rebuild project
serializer
  • 1,003
  • 2
  • 13
  • 27
1

Deleting licenses.licx file is not a solution. It will give you error at runtime if you are using third party control which need licenses.

LC.exe takes argument as licenses file with full path, if argument is too long, it throw error.

So keep the file name and path shorter length, it will compile and work.

  • Again that will only work if your solution is small enough. With a larger solution that has lc.exe dependent components, your base path will start to become a lesser factor. – Shiv Jul 27 '16 at 21:21
0

Deleting licence file did not help me. I end up deleting the "licenses.licx" under the Solution Explorer -> Properties group Surly that helps

Kiarash
  • 1,701
  • 2
  • 16
  • 20
  • 1
    Unfortunately this is just a workaround and not a long term solution. Microsoft need to address scalability of the lc.exe program. – Shiv Apr 28 '16 at 21:20
0

This issue is fixed in VS2017 as per this GitHub checkin: https://github.com/Microsoft/msbuild/commit/e49717c727c3cab4db466bcb0a5abb624a8156bb I believe the version is full release version is VS2017 Update 2.

Shiv
  • 1,274
  • 1
  • 19
  • 23