Failed to start LC.exe

When compiling, I get LC.EXE error message

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

This error occurs when compiling my unit test project. Of the Google tricks I've seen, nothing worked.

  • I am configured on Target framework = ".NET Framework 4" and not on the client profile.

It started today. There is almost nothing in version control history. All changes are related to AssemblyInfo.cs when a third-party utility increases our version #.

UPDATE
Displaying my output window by invoking the command line for LC.EXE HUGE

CompileLicxFiles:
C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\bin\NETFX 4.0 Tools\LC.exe /target:BuildAll.Tests.dll /complist:Properties\licenses.licx /outdir:obj\Debug\ /i:C:\

There are 100 parameters /i ...

+15
source share
7 answers

There is a workaround for MS support:

when you build a project, delete the license file from the project every time you get this error, just delete the license file

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

+13
source

I changed the value of the Build Action property from EmbeddedResource to None in the licenses.licx file. This solved the problem.

+3
source

had the same problem. A command line is created for Lc.exe, which is limited to characters of the order of 32 thousand characters. In this command, usually all links are written using the full path.

therefore, if you have many links, you may run into problems.

There are a few things you can do: - Remove unused links - Make sure you are not referencing indirect bindings. Use instead a tooltip path that you can define for assemblies. - Shorten the path in which the links are located - You can create a virtual disk to put refs there to get a short link path (for example, Z: \ my.dll)

+2
source

I had a problem today and it was resolved when I changed the link path to a longer path. For example, I originally put it in mydocuments\user\...\...\.. But when I changed the path to c:\dlls\ , it worked like a charm. Hope this helps.

0
source

I had a bad problem with the LC.exe file, everything was due to the fact that the components that I used were on a network drive (G :) and from this position I could never compile the executable file. I finally decided by adding the IP address of the network drive between intranet sites reliable in Internet settings.

0
source

I used the "Subst" command line utility listed on this post blog to solve my problem with LC.exe.

  • Turn on Normal or higher. Fidelity for your assembly.
  • In the Output window, check the line where the LC task runs. Note that there will be many / i options with paths to other binaries.
  • Find one or more paths that you can use β€œSubst” to shorten the path, to reduce the total length of all parameters passed to β€œLC.exe”.
  • Then open the problem project properties window in Visual Studio and select the Links tab, and then add the new drives that you identified using Subscriptions.

Create a project.

Remember that Substitution is not saved on reboot.

0
source

I had the same problem, I added this code to my project, and it worked.

 <Target Name="WorkaroundMSBuild2836" BeforeTargets="CompileLicxFiles"> <!-- Work around https://github.com/Microsoft/msbuild/issues/2836 by temporarily setting TargetFrameworkVersion to a version high high enough to cause the LC task to use a response file. --> <PropertyGroup> <_OriginalTargetFrameworkVersion>$(TargetFrameworkVersion) </_OriginalTargetFrameworkVersion> <TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion> </PropertyGroup> </Target> <Target Name="UndoWorkaroundMSBuild2836" AfterTargets="CompileLicxFiles"> <PropertyGroup> <TargetFrameworkVersion>$(_OriginalTargetFrameworkVersion) </TargetFrameworkVersion> </PropertyGroup> </Target> 

For more information read this post.

0
source

All Articles