Visual studio - dotless.compiler

2.8k Views Asked by At

I need from file ".less" create ".css" file with standart CSS logic before build.

I tried drop dotless.compiler.exe at folder and at Pre-Build event call this command

$(SolutionDir)content\folder\dotless.compiler.exe -m 
$(ProjectDir)content\css\site.less $(ProjectDir)content\css\site.css

but get exception "command exited with code 3". Where am I wrong? Can you offer another way?

4

There are 4 best solutions below

0
On

I was also getting error -3. My problem was that my files were under source control and were locked so the compiler could not overwrite css file. So, your problem might also be that your css file that needs to be overwritten is locked.

0
On

I had the same problem on windows 8.1 and VS 2013. None of the suggest solutions helped me.

Then I run the dotless compiler explicitly on the CMD as administrator and it worked!

0
On

I can't help with the exception from the Pre-Build event, but in the past I've used chirpy to generate css files.

I've also used squishit, which generates the css at runtime, as opposed to build/compile.

0
On

I've found two common instances where I've received that error code when using the dotless compiler in a prebuild event. The first is if the css files already exist within source control and are locked. The second is when a space (or special character) exists in the file paths to the .less or .css files

This can be fixed by deleting the css file prior to running the compile, and putting all filepaths in quotes:

del "$(ProjectDir)content\css\site.css"
"$(SolutionDir)content\folder\dotless.compiler.exe" -m "$(ProjectDir)content\css\site.less" "$(ProjectDir)content\css\site.css"