Kiran Srikanta
Kiran Srikanta

Reputation: 51

The specified task executable "LC.exe" could not be run

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.

Upvotes: 5

Views: 8822

Answers (5)

serializer
serializer

Reputation: 1013

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

Upvotes: 2

Shiv
Shiv

Reputation: 1404

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.

Upvotes: 0

Raman Sharma
Raman Sharma

Reputation: 11

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.

Upvotes: 1

Kiarash
Kiarash

Reputation: 1919

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

Upvotes: 0

zchpit
zchpit

Reputation: 3121

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

Upvotes: 2

Related Questions