Visual Studio - dotless.compiler
我需要在构建之前从文件“.less”创建具有标准 CSS 逻辑的“.css”文件。
我尝试将 dotless.compiler.exe
放在文件夹中,并在预构建事件中调用此命令
$(SolutionDir)content\folder\dotless.compiler.exe -m
$(ProjectDir)content\css\site.less $(ProjectDir)content\css\site.css
,但出现异常“命令已退出,代码为 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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
我发现在预构建事件中使用无点编译器时收到该错误代码的两个常见实例。第一个是 css 文件是否已存在于源代码管理中并且被锁定。第二种情况是 .less 或 .css 文件的文件路径中存在空格(或特殊字符)。
这可以通过在运行编译之前删除 css 文件并将所有文件路径放在引号中来修复:
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:
我也收到错误-3。我的问题是我的文件受源代码控制并被锁定,因此编译器无法覆盖 css 文件。
所以,你的问题也可能是你需要覆盖的css文件被锁定了。
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.
我无法解决预构建事件的异常,但在过去我使用过 chirpy生成css文件。
我还使用了 squishit ,它会生成运行时的 css,而不是构建/编译。
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.
我在 Windows 8.1 和 VS 2013 上遇到了同样的问题。建议的解决方案都没有帮助我。
然后我以管理员身份在 CMD 上显式运行无点编译器,它成功了!
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!