This project is read-only.


Don't return an error when provided no files


When the CompressorTask is called from my project, I receive an error if there aren't any files provided to the JavaScriptFiles & CssFiles parameters ("At least one css or javascript file is required to be compressed / minified.") I want to include this generic task in all of my projects, and have it automatically minify JavaScript files when I build. So when I start a project, I may not have any JavaScript files, but would like to have the task in place.
It seems like the CompressorTask should exit without error (just do nothing, or maybe display a warning) if provided with no files.
Closed Jan 17, 2011 at 1:54 AM by purekrome


purekrome wrote Oct 14, 2009 at 8:23 AM

Hmm. interesting scenario.

What happens if we add an extra configuration key? DoNotErrorWhenNoFilesProvided or something? default is false (ie. throw an error).


dukesb11 wrote Oct 14, 2009 at 2:46 PM

That would work. I also don't know if I'm missing something in MSBuild that would let me check whether I have any items in the collection before calling the task, but I wasn't able to find that...

wrote Jun 7, 2010 at 1:17 AM

purekrome wrote Jan 6, 2011 at 5:15 AM

@dukesb11 : heya mate. Ok, a new property has been added to the Task. By default, it's false (which means, no files then an error is thrown). But if this optional value is set to TRUE, then if there's no files, then there's no errors.

How's that sound?

This will be released in the new build. I've not checked in the code yet .. but will soon and will release, soon.

wrote Jan 6, 2011 at 5:24 AM

dukesb11 wrote Jan 6, 2011 at 2:59 PM

Sounds great. Thanks.

wrote Jan 17, 2011 at 1:54 AM

xabedama wrote Jul 21, 2011 at 3:28 PM

Finally, which is the name of this optional parameter please?

dukesb11 wrote Jul 21, 2011 at 4:04 PM

Add DoNotErrorWhenNoFilesAreProvided="true"

purekrome wrote Jul 21, 2011 at 4:52 PM

Cheers dykesb11 :) that sounds right ;)

wrote Feb 22, 2013 at 12:55 AM

wrote May 16, 2013 at 12:20 PM