An MSBuild target for linting Less code using Lesshint.
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.

Lesshint for MSBuild

NuGet Version and Downloads count

An MSBuild target for linting Lesshint code using Lesshint. Get it at


Add this package using the Visual Studio's NuGet Package Manager. It should be automatically added to your project.

Define a LessCompile property in your .csproj/.targets consisting of the names of .less files to lint. The Lesshint target runs after a target named CompileLessFiles.

Lesshint's default configurations are used by default. If you'd like to use your own .lesshintrc file, add a LesshintConfig property to your project:


All overrideable item groups and properties are below. Read the Lesshint documentation for Lesshint-specific linting details.

Overrideable Item Groups

Item Group Description Default
LesshintExclude A minimatch glob pattern or a file to exclude form being linted. (blank)
LesshintLinters Require paths of custom linters to add to the built-in list. (blank)

Note that to use special characters (such as * wildcards) in LesshintExclude you must escape the special characters.

<!-- Equivalent to "styles/external/*.less" -->
<LesshintExclude Include="styles/external/%2A.less" />

Overrideable Properties

Property Description Default
LesshintBreakBuildOnError Whether linting failures should break the build. false
LesshintConfig Path to a specific .lesshintrc. (blank)
LesshintCli Path to a Lesshint CLI to run with. The highest-versioned Lesshint version in the solution's packages directory.
LesshintDisabled Whether to skip running Lesshint. false
LesshintExtraArgs Any extra arguments to pass to the Lesshint CLI. (blank)
LesshintNodeExe Path to a Node executable to execute the runner script. The tools\node-6.1.0.exe in the package.
LesshintVersion Glob filter for the version of Lesshint to use (ignored if LesshintConfig is provided). *.*.*

Output Item Groups

Item Group Description
LesshintOutput Lines of console output from the Lesshint CLI.

Output Properties

Property Description
LesshintErrorCode Exit code of the Lesshint CLI.

Lesshint version

The first available Lesshint version in your NuGet packages directory will be used.


Run the following commands to initialize your environment:

npm install

Run gulp to build. gulp test just runs tests.

Updating the version

The version number is stored both in package.json and Lesshint.MSBuild.nuspec. Make sure to update it in both places.