Visual Studio - dotless.compiler

发布于 2024-12-12 03:59:26 字数 333 浏览 0 评论 0原文

我需要在构建之前从文件“.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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

一腔孤↑勇 2024-12-19 03:59:26

我发现在预构建事件中使用无点编译器时收到该错误代码的两个常见实例。第一个是 css 文件是否已存在于源代码管理中并且被锁定。第二种情况是 .less 或 .css 文件的文件路径中存在空格(或特殊字符)。

这可以通过在运行编译之前删除 css 文件并将所有文件路径放在引号中来修复:

del "$(ProjectDir)content\css\site.css"
"$(SolutionDir)content\folder\dotless.compiler.exe" -m "$(ProjectDir)content\css\site.less" "$(ProjectDir)content\css\site.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:

del "$(ProjectDir)content\css\site.css"
"$(SolutionDir)content\folder\dotless.compiler.exe" -m "$(ProjectDir)content\css\site.less" "$(ProjectDir)content\css\site.css"
天暗了我发光 2024-12-19 03:59:26

我也收到错误-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.

ぽ尐不点ル 2024-12-19 03:59:26

我无法解决预构建事件的异常,但在过去我使用过 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.

无戏配角 2024-12-19 03:59:26

我在 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!

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文