I’m adding a post build task to run the Ajax Minifier (ajaxMin.exe) whenever a relase build of a project is conducted. I’ve added the code to the project to compress all CSS and JavaScript, but when triggering a build on the TFS build server I get lots of build errors in the BuildLog.txt with the message:
error : The Microsoft Ajax Minifier does not have permission to write to JS[filename].js
I get one message for each JavaScript and CSS file and rightly enough loking at the build output, no minification has taken place. The project is under source control, but I thought being a post build task, this wouldn’t matter as its minifying the output on the build server, not the source files themselves? The code added to my .csproj is as follows:
<Import Project="$(MSBuildExtensionsPath)\Microsoft\MicrosoftAjax\AjaxMin.tasks" />
<Target Name="AfterBuild" Condition=" '$(ConfigurationName)'=='Release' ">
<ItemGroup>
<JsFilesRelease Include="**\*.js" Exclude="**\*.min.js" />
<CssFilesRelease Include="**\*.css" />
</ItemGroup>
<AjaxMin JsSourceFiles="@(JsFilesRelease)" JsSourceExtensionPattern="\.js$" JsTargetExtension=".js"
CssSourceFiles="@(CssFilesRelease)" CssSourceExtensionPattern="\.css$" CssTargetExtension=".css" />
</Target>
Is there any way I can get around this restriction? I want to ensure that all outputted files from the above are minified and it seems its only the permissions that are preventing it.
Thanks