2

I have some post build event to minify my css and javascript using ajaxmin

if $(ConfigurationName) == Debug  $(ProjectDir)..\Tools\ajaxmin.exe -xml $(ProjectDir)Scripts\Combine.xml -js -clobber
if $(ConfigurationName) == Debug $(ProjectDir)..\Tools\ajaxmin.exe 

This increased my build time from about 7 or 8 seconds to about 12 - 15, (building the project during development those seconds add up you know. I've gone to a lot of effort to reduce build time for this app. )

I'd like to run this task only if the files in the combine.xml have changed.

My initial thought is to set up a file watch windows service to write changes to a txt file,

Then check the text file on the post build command,

But I don't know how to do this last bit.

Is there a way to check a value in a Text file using post build events ?

Axe
  • 764
  • 6
  • 29

2 Answers2

1

You could use a PowerShell script as postbuild event, and check the files modification dates, e.g.

(Get-Item .\combine.xml).LastWriteTime

Then you regenerate the file only if the LastWriteTime of the partial files is greater than the LastWriteTime of the combined file.

I don't know if you can do that with a regular post-build script.

Paolo Tedesco
  • 55,237
  • 33
  • 144
  • 193
  • some further info on [powershell for post build comands](http://stackoverflow.com/questions/6500320/post-build-event-execute-powershell) – Axe Apr 04 '12 at 12:31
0

You can try FC command This returns the differences of the two files.

fc file1 file2 
if %ERRORLEVEL%==0
Run your postbuild event here
Kiru
  • 3,489
  • 1
  • 25
  • 46