msbuild: .NET Core MSBuild is missing the LC task

From @alienisty on April 24, 2017 1:58

Steps to reproduce

Just create a project with a licenses.licx file definition and build the project with

dotnet build project.csproj

Expected behavior

The project builds and the license information are compiled in the binaries

Actual behavior

The following error is raised:

C:\Program Files\dotnet\sdk\1.0.3\Microsoft.Common.CurrentVersion.targets(2977,5): error MSB4062: The “Microsoft.Build.Tasks.LC” task could not be loaded from the assembly Microsoft.Build.Tasks.Core, Version=15.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a. Confirm that the <UsingTask> decl aration is correct, that the assembly and all its dependencies are available, and that the task contains a public class that implements Microsoft.Build.Framework.ITask. 0 Warning(s) 1 Error(s)

Environment data

dotnet --info output:

.NET Command Line Tools (1.0.3)

Product Information: Version: 1.0.3 Commit SHA-1 hash: 37224c9917

Runtime Environment: OS Name: Windows OS Version: 6.3.9600 OS Platform: Windows RID: win81-x64 Base Path: C:\Program Files\dotnet\sdk\1.0.3

Copied from original issue: dotnet/cli#6389

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Reactions: 5
  • Comments: 17 (10 by maintainers)

Most upvoted comments

@sansjunk thanks for the scenario explanation. I will be working with my team to make a plan for when/how we migrate lc.exe support to Core.

Running desktop lc.exe on core assemblies is busted. See https://github.com/dotnet/corefx/issues/24200#issuecomment-461803927. I think this needs to be fixed. We have had a few customers ask for the licensing functionality in netcore 3.0.

I know it’s been discussed, but I don’t know where the discussions have landed yet.

The LC task wasn’t ported to .NET Core because lc.exe isn’t available in a cross-platform version (that I know of, anyway). The task just calls the executable, so it wouldn’t work on non-Windows platforms.

The best way to deal with this today is to use full-framework msbuild.exe, which does have the task.

@rustyhann, you’re saying that’s not working for you, which is unexpected. How exactly are you invoking the build? Could you share a diagnostic-level build log?