Targets for Microsoft Library Manager integration. Include this project via NuGet or import its Props and Targets files to ensure the vendor assets in your libman.json are fetched before build and included during publishing.
This target reduces configuration boilerplate related to code generation and applies necessary workarounds (e.g. issues with deployment mentioned here).
For general details about and usage instructions see the root Readme.
Do you want to quickly try out this project and see it in action? Check it out in our Open-Source Orchard Core Extensions full Orchard Core solution and also see our other useful Orchard Core-related open-source projects!
- Reference the targets in your project file by adding an
<Import>element with the relative path of the Props file at the top end of your project file, and one for the Targets file at bottom end. - If the
Lombiq.HelpfulLibraries.SourceGeneratorsproject is not found, specify the local relative path to the submodule in the<LombiqHelpfulLibrariesPath>property before the<Import>element for the Props file.
For example:
<Project>
<Import Project="../../../Utilities/Lombiq.MSBuild.Targets/Lombiq.MSBuild.LibMan.Targets/Lombiq.MSBuild.LibMan.Targets.props" />
<ItemGroup>
<PackageReference Include="Microsoft.Web.LibraryManager.Build" Version="3.0.71" />
</ItemGroup>
<Import Project="../../../Utilities/Lombiq.MSBuild.Targets/Lombiq.MSBuild.LibMan.Targets/Lombiq.MSBuild.LibMan.Targets.targets" />
</Project>- Reference the targets in your project file by adding the
Lombiq.MSBuild.LibMan.TargetsNuGet package. - To use Library Manager during build, reference the
Microsoft.Web.LibraryManager.BuildNuGet package. - Optionally, if you want to use the automatically generated version numbers (e.g. when declaring an asset in the Orchard Core resource manager), you have to include the
Lombiq.HelpfulLibraries.SourceGeneratorsandLombiq.HelpfulLibraries.Attributesprojects from the Lombiq HelpfulLibraries.
For example:
<Project>
<ItemGroup>
<PackageReference Include="Microsoft.Web.LibraryManager.Build" Version="<latest version>" />
<PackageReference Include="Lombiq.MSBuild.LibMan.Targets" Version="<latest version>" />
<PackageReference Include="Lombiq.HelpfulLibraries.Attributes" Version="<latest version>" OutputItemType="Analyzer" ReferenceOutputAssembly="true" />
<PackageReference Include="Lombiq.HelpfulLibraries.SourceGenerators" Version="<latest version>" OutputItemType="Analyzer" ReferenceOutputAssembly="false" />
</ItemGroup>
</Project>- If you don't have a libman.json file yet, build the project after setup. This will copy an empty libman.json file into the project directory, which is pre-configured to use the expected package output directory.
- Now you can install new NPM packages using the CLI tool like this:
libman install "{NpmPackageName}@{Version}", e.g.libman install chart.js@4.5.1. - If you want to use the automatically generated version numbers (e.g. when declaring an asset in the Orchard Core resource manager), follow the instructions in the Helpful Libraries documentation.
Bug reports, feature requests, comments, questions, code contributions and love letters are warmly welcome. You can send them to us via GitHub issues and pull requests. Please adhere to our open-source guidelines while doing so.
This project is developed by Lombiq Technologies. Commercial-grade support is available through Lombiq.