tags:

views:

429

answers:

1

Hello,

I'm trying to use the YIUCompression DLL in MSbuild (http://yuicompressor.codeplex.com/Release/ProjectReleases.aspx?ReleaseId=22364)

but I keep on getting the following error when i run the MSBuild:

OUTPUT:

Target Build: Starting Css/Javascript compression...

# Found one or more JavaScript file arguments. Now parsing ...
    ** Obfuscate Javascript: Yep!
    ** Preserve semi colons: Yep!
    ** Disable optimizations: Hell No!
    ** Line break position: None
    ** Thread Culture: Not defined
# 1 JavaScript file requested.
    => C:\JSMinify\YIUCompressor\Test\disableButton.js    C:\JSMinify\YIUCompressor\Millena-I.Build.proj(17,5): error : Failed to read in the data for the path/file [C:\JSMinify\YIUCompressor\Test\disableButton.js]. The most common cause for this is because the path is incorrect or the file name is incorrect ... so please check your path and file names. Until you fix this up, I can't continue ... sowwy.
C:\JSMinify\YIUCompressor\Millena-I.Build.proj(17,5): error : Value cannot be null.
C:\JSMinify\YIUCompressor\Millena-I.Build.proj(17,5): error : Parameter name: value
    Finished compressing all 1 file.
Total original JavaScript file size: 405. After compression: 0. Compressed down to 0% of original size.
Compressed content saved to file [C:\JSMinify\YIUCompressor\Test\disableButton.js].

Finished Css/Javascript compression.
Total time to execute task: 00:00:00.0312510

Done building target "Build" in project "Millena-I.Build.proj".

Done building project "Millena-I.Build.proj".

Build succeeded. C:\JSMinify\YIUCompressor\Millena-I.Build.proj(17,5): error : Failed to read inthe data for the path/file [C:\JSMinify\YIUCompressor\Test\disableButton.js]. The most common cause for this is because the path is incorrect or the file name is incorrect ... so please check your path and file names. Until you fix this up, I can't continue ... sowwy.C:\JSMinify\YIUCompressor\Millena-I.Build.proj(17,5): error : Value cannot be null. C:\JSMinify\YIUCompressor\Millena-I.Build.proj(17,5): error : Parameter name: value

Following is my build script:

<!-- Execute CompressorTask for each file in the list -->
<CompressorTask
   Condition="'%(JavaScriptFiles.Identity)' != ''"
   JavaScriptFiles="%(JavaScriptFiles.Identity)"
   ObfuscateJavaScript="FoSho"
   PreserveAllSemicolons="Yeah"
   DisableOptimizations="Nope"
   EncodingType="Default"
   DeleteJavaScriptFiles="true"
   JavaScriptOutputFile="%(JavaScriptFiles.Identity)"
   LoggingType="ALittleBit" />

I have given full rights ot the folder and the file (removed Read-only).The surprising part is that when the build fails my file is completely blank !

+1  A: 

Hi,

I've used the java version of YUICompressor for my last ASP.NET project. Does it work for you, or you're just interested in the .dll file? Below is my target task.

<Target Name="MinifyScripts" Condition="Exists('$(JAVA_HOME)')">        
    <YuiCompress Files="@(JavaScriptContent)" Type="JS" JavaHome="$(JAVA_HOME)" YUIHome="$(MSBuildStartupDirectory)\Resource\BuildTool\yuicompressor-2.4.1.jar" />
    <YuiCompress Files="@(CssContent)" Type="CSS" JavaHome="$(JAVA_HOME)" YUIHome="$(MSBuildStartupDirectory)\Resource\BuildTool\yuicompressor-2.4.1.jar" />
</Target>

It's really straightforward. Try using it.

EDIT: Dave Ward wrote a nice article about this topic here (http://tinyurl.com/r8mdku).

[]'s Fernando

nandokakimoto