Partager via


LC Task

Wraps LC.exe, which generates a .license file from a .licx file. For more information on LC.exe, see License Compiler (Lc.exe).

Parameters

The following table describes the paramters for the LC task.

Parameter Description

ExitCode

Optional Int32 output read-only parameter.

Specifies the exit code provided by the executed command.

LicenseTarget

Required ITaskItem parameter.

Specifies the executable for which the .licenses files are generated.

NoLogo

Optional Boolean parameter.

Suppresses the Microsoft startup banner display.

OutputDirectory

Optional String parameter.

Specifies the directory in which to place the output .licenses files.

OutputLicense

Optional ITaskItem output parameter.

Specifies the name of the .licenses file. If you do not specify a name, the name of the .licx file is used and the .licenses file is placed in the directory that contains the .licx file.

ReferencedAssemblies

Optional ITaskItem[] parameter.

Specifies the referenced components to load when generating the .license file.

Sources

Required ITaskItem[] parameter.

Specifies the items that contain licensed components to include in the .licenses file. For more information, see the documentation for the /complist switch in License Compiler (Lc.exe).

Timeout

Optional Int32 parameter.

Specifies the amount of time, in milliseconds, after which the task executable is terminated. The default value is Int.MaxValue, indicating that there is no time out period.

ToolPath

Optional String parameter.

Specifies the location from where the task will load the underlying executable file (Lc.exe). If this parameter is not specified, the task uses the SDK installation path corresponding to the version of the framework that is running MSBuild.

Remarks

Example

The following example uses the LC task to compile licenses.

<Project xmlns="https://schemas.microsoft.com/developer/msbuild/2003">
<!-- Item declarations, etc -->

    <Target Name="CompileLicenses">
        <LC
            Sources="@(LicxFile)"
            LicenseTarget="$(TargetFileName)"
            OutputDirectory="$(IntermediateOutputPath)"
            OutputLicenses="$(IntermediateOutputPath)$(TargetFileName).licenses"
            ReferencedAssemblies="@(ReferencePath);@(ReferenceDependencyPaths)">

            <Output
                TaskParameter="OutputLicenses"
                ItemName="CompiledLicenseFile"/>
        </LC>
    </Target>
</Project>

See Also

Concepts

MSBuild Tasks

Other Resources

MSBuild Task Reference