共用方式為


LC Task

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

Parameters

The following table describes the paramters for the LC task.

Parameter

Description

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.

SdkToolsPath

Optional String parameter.

Specifies the path to the SDK tools, such as resgen.exe.

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 Lc.exe (License Compiler).

In addition to the parameters listed above, this task inherits parameters from the ToolTaskExtension class, which itself inherits from the ToolTask class. For a list of these additional parameters and their descriptions, see ToolTaskExtension Base Class.

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