问题
The AjaxMin project at http://ajaxmin.codeplex.com/ is great and very useful.
What I have previously used is the code option of AjaxMin where I would manually scan a directory for all JS and CSS files, and minify the contents, then rewrite the original file with the minified content.
This code would be run in a custom "BuildConfigurator" that was created just for the purpose of running on builds to get them ready for deployment.
We have since made the decision to get rid of BuildConfigurator and use TFS2010 to do all the builds. I have started using the TFS Build Workflows and I need to now minify all my JS/CSS files (same filename).
How can I do this in the TFS Build Workflow? It should be doable, right?
I saw documentation on how to add it to the project definition at http://ajaxmin.codeplex.com/wikipage?title=AjaxMinTask but that seems to be at the project level. I want to be able to do it for the whole solution/build, where the minifying would only be done with a TFS Build, as opposed to a local build on any devs machine.
Any help would be greatly appreciated. Thank you.
回答1:
You just need to write the task in the project file as it use in the local machine without TFS, see the following link,
Why Microsoft Ajax Minifier doesn't generate mini file with Team build 2010?
I also create the minify file inside the web package.
After that install AjaxMin.exe on the TFS server, so now when the TFS start invoke the MS Build activity to build the application by default it will Minify the files, just be careful of the file path between local and server so it can work on both local path and server path(TFS)
回答2:
I ended up creating a custom build activity code that i called AjaxMinify that took in a directory path as input (set in the build workflow), and it then minified all files in the directory/sub-directories. I just referenced the AjaxMin.dll in the code project for the activity. Then just add the AjaxMinify activity in the build workflows that you want and presto it works! Thanks for the answers tho.
来源:https://stackoverflow.com/questions/6741675/microsoft-ajax-minifier-tfs-2010-workflow-ajaxmin-in-the-tfs-build