3

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?

madth3
  • 7,275
  • 12
  • 50
  • 74
Mess
  • 31
  • 1
  • 2
  • Did you check all the files and executables are in place correctly? – Tariqulazam Oct 26 '11 at 11:01
  • I think that all is okay – Mess Oct 26 '11 at 11:44
  • What is the working directory in your case? maybe that's the issue? – Tigraine Oct 26 '11 at 18:27
  • @Tigraine: I'm having the same issue, any idea? $(SolutionDir)\packages\dotless.1.3.0.0\Tools\dotless.compiler.exe -m "$(ProjectDir)\Assets\Styles\Debug\*.less" "$(ProjectDir)\Assets\Styles\Release\*.css" – Michael Mar 29 '12 at 20:28
  • Does the compiler generate any output in the site.css files? Because to me the syntax looks fine .. you could try omitting the output file parameter so the compiler uses it's built in default of site.css but other than that this looks fine.. Do you do anything fancy with imports that may break due to working directory problems? – Tigraine Apr 18 '12 at 09:04

4 Answers4

6

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"
Matt Girolami
  • 61
  • 1
  • 4
3

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.

Nastyface
  • 31
  • 2
0

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!

Elisabeth
  • 20,496
  • 52
  • 200
  • 321
0

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.

Bela
  • 3,437
  • 1
  • 20
  • 12