KB 0036
During build, receive error MSB6002 or MSB6003 at license compiler step.


ASComm IoT



Whan building .NET Core application, you may receive one of the following error messages

Error MSB6002 The command-line for the "LC" task is too long. Command-lines longer than 32000 characters are likely to fail.


Error MSB6003 The specified task executable "lc.exe" could not be run. System.ComponentModel.Win32Exception (0x80004005): The filename or extension is too long



This is caused by a License Compiler issue and is documented on the following github page




1. Create a backup for your project file (C# project file is *.csproj, VB project file is *.vbproj).

2. Open your project file using Visual Studio Code or any text editor.

3. Add the following code to your project between <Project> and </Project> tags

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


We added after the following entry and have verified success

  <EmbeddedResource Include="licenses.licx" />