我正在尝试使用构建脚本来运行 dotless.compiler.exe 以在构建时将我的 .less 文件编译为 .min.css:
<?xml version="1.0" encoding="utf-8" ?>
<Project xmlns="http://schemas.microsoft.com/developer/MsBuild/2003">
<!--
This MSBuild Script will compile all [*.less] files in the /CSS folder to their [*.min.css] counterparts.
-->
<ItemGroup>
<LessFiles Include="Styles\*.less" />
</ItemGroup>
<Target Name="CompileDotlessCss" AfterTargets="AfterBuild">
<ItemGroup>
<Binaries Include="*.dll;*.exe"/>
</ItemGroup>
<!-- Compile dotLess CSS into minified full CSS -->
<Exec Command="[MSBuild]\dotless.compiler.exe -m %(LessFiles.FullPath) $([System.String]::Copy('%(LessFiles.FullPath)').Replace('.less','.min.css'))" />
</Target>
</Project>
但是当我构建时,我得到:
The command "[MSBuild]\dotless.compiler.exe -m C:\Source Control\MyProject\MyProject.Web\Styles\main.less C:\Source Control\MyProject\MyProject.Web\Styles\main.min.css" exited with code -1.
我怀疑这与我的项目受源代码管理有关,或者只是文件路径在“源代码管理”文件夹中有一个空间。
如何将路径括在引号中(因为命令本身在引号中)?
如果它是源代码控制因素并且由于文件被锁定而失败(我尝试使用签入的文件进行构建)..我该如何处理?我显然想让我的项目处于源代码控制之下。