LC.exe could not be run

Viewed 19494

On compilation I receive error for LC.EXE

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

This error occurs when I compile my unit test project. Of the google tricks I've seen, nothing has worked.

  • I am set to Target framework = ".NET Framework 4" not client profile.

This started today. There's hardly anything in source control history. The changes all have to do with AssemblyInfo.cs where a 3rd party utility increments our version #'s.

UPDATE
Looking out my output window the command line call to LC.EXE is 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's 100's of /i params...

7 Answers

I had the same issue, I added this code into 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 further information read this post

Related