WebGrease build task

WebGrease includes an MSBuild task that you can use to incorporate WebGrease into your automated builds. The WebGrease build task includes caching capabilities, which provide greatly increased build speeds through the use of incremental builds.

WebGrease also includes a WebGrease build override file. This is intended to be used on a developer machine to reduce the amount of files that WebGrease builds.

For more information about MSBuild, see MSBuild and MSBuild Tasks on MSDN.

WebGreaseTask

The WebGreaseTask wraps WG.exe.

Task parameters

Parameter Description

Activity

Optional string parameter.

Specifies the WebGrease activity as either Bundle or Everything. The default is Everything.

ApplicationRootPath

Optional string parameter.

Specifies the root path of the WebGrease application.

CacheEnabled

Optional Boolean parameter.

If this parameter is true, WebGrease uses caching.

CacheRootPath

Optional string parameter.

Specifies the root path for caching. To enable caching on a build server, use the system temp folder (%temp%).

CacheTimeout

Optional string parameter.

Specifies how long to keep cache items that have not been accessed. Both read and write operation access a cache item. This value must be able to be parsed into a Timespan.

CacheUniqueKey

Optional string parameter. Required if the CacheEnabled parameter is set to true.

Specifies a unique key for the cache. Use the project GUID and Visual Studio solution configuration (such as debug or release) to distinguish caches for different projects.

CleanCache

Optional Boolean parameter.

If this parameter is true, WebGrease cleans the cache before any processing.

CleanDestination

Optional Boolean parameter.

If this parameter is true, WebGrease cleans the destination folders before any processing.

ConfigType

Optional string parameter.

Specifies the solution’s configuration type.

ConfigurationPath

Optional string parameter.

Specifies the path to the WebGrease configuration file.

LogFolderPath

Optional string parameter.

Specifies the location where log files are saved.

Measure

Optional Boolean parameter.

If this parameter is true, WebGrease measures the elapsed time for each activity and logs this to the location specified by the ReportPath parameter. The reports contain the duration and execution count of each WebGrease activity.

OverrideFile

Optional string parameter.

Specifies the location of the WebGrease build override file.

PreprocessingPluginPath

Optional string parameter.

Specifies the path to the configuration assemblies. The default is the location of the build task assembly.

ReportPath

Optional string parameter.

Specifies the folder where report files are saved.

RootInputPath

Optional string parameter.

Specifies the root input path. This value is prepended to all relative paths.

RootOutputPath

Optional string parameter.

Specifies the root output path.

Remarks

In addition to the cache-related task parameter listed above, you must do one of the following to enable caching:

  • In your project file, add the following element and value in your propertygroup element:

    <WebGreaseCacheEnabled>True</WebGreaseCacheEnabled>
  • If you are running MSBuild manually, include the following command-line option:

    /d:WebGreaseCacheEnabled=true

If you are using Team Foundation Server (TFS) builds, include the following option to start with a clean cache for a daily build:

/p:WebGreaseCleanCache=true

Example WebGrease build task configuration

<WebGreaseTask
   Activity="Everything"
   ApplicationRootPath="$(WGRootPath)"
   ConfigType="$(Configuration)"
   LogFolderPath="$(WGLogPath)"
   ConfigurationPath="$(WGConfigPath) "
   RootOutputPath="$(WGOutputPath) "
   RootInputPath="$(WGInputPath) "
   PreprocessingPluginPath="$(WGTemp)"
   CacheEnabled="$(WebGreaseCacheEnabled)"
   CacheRootPath="%Temp%\_webgrease.cache"
   CacheUniqueKey="$(AssemblyName)-$(ProjectGuid)"
   CacheTimeout="12:00:00"
   CleanCache="$(WebGreaseCleanCache)"
   CleanDestination="$(WebGreaseCleanDestination)"
   Measure="true"
   ReportPath="$(WGRootPath)\reports"
   OverrideFile="$(WebGreaseOverrideFile)"
/>

See Also

Last edited Sep 4, 2013 at 8:02 PM by JeffRob, version 1

Comments

No comments yet.