开发者

Running batch file on post-build event : Error 46 The command .... exited with code 9009

I am trying to run a batch file on post-build event but I am failing. the following is my text which I have put my post-build event;

E:\Documents\Tools\minify-css-files.bat

And I am getting this;

Error 46 The command "E:\Documents\Tools\minify-css-files.bat" exited with code 9009.

When I run the batch file outside t开发者_如何学JAVAhe VS, it is ok. Here is my batch file.

AjaxMin ..\Content\site.css -out ..\Content\site.ajaxmin.css –clobber
AjaxMin ..\Content\search-engine.css -out ..\Content\search-engine.ajaxmin.css –clobber
AjaxMin ..\Content\print.css -out ..\Content\print.ajaxmin.css –clobber
AjaxMin ..\Content\site.easyslider.css -out ..\Content\site.easyslider.ajaxmin.css –clobber


Anyway, always escape spaces in all paths used, e.g. ... "$(ProjectDir)" ...


You'll have to use the Visual Studio post-build macros in order to get the full path to your project files.

Here's an example:

AjaxMin "$(ProjectDir)Content\site.css" -out "$(ProjectDir)Content\site.ajaxmin.css" –clobber

The $(ProjectDir) macro will be translated to the full path of the project directory, including the trailing backslash.

Note that the macros are expanded by Visual Studio during a build process, which means that your batch file will no longer work when invoked outside of that context.

Related resources:

  • Visual Studio Pre-build/Post-build event macros
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜