Error when running post build

Jun 25, 2012 at 6:16 PM

I get the following error when running the build:

Error 41 The command "c:\Windows\Microsoft.NET\Framework\v4.0.30319\msbuild.exe "C:\WorkingFolder\FCCI20_FSS\FCCI20\YUICompressor\yuicompressor.xml"/p:CssOutputFile="C:\WorkingFolder\FCCI20_FSS\FCCI20\css.min\StylesSheetFinal.css"/p:JavaScriptOutputFile="C:\WorkingFolder\FCCI20_FSS\FCCI20\js.min\JavascriptFinal.js"" exited with code 123. FCCI20

This is what I typed for the post build:

$(MSBuildBinPath)\msbuild.exe "$(ProjectDir)YUICompressor\yuicompressor.xml"/p:CssOutputFile="$(ProjectDir)css.min\StylesSheetFinal.css"/p:JavaScriptOutputFile="$(ProjectDir)js.min\JavascriptFinal.js"

The macros are correct however I do not know what is the cause. Any ideas?

Coordinator
Jun 27, 2012 at 1:55 PM

Hi,

Can you state which version you are using and, ideally,  provide a zip of a complete example of this happening so we can recreate it?

thanks

Jun 27, 2012 at 3:29 PM

Thanks for your response:

YUI Compressor Version 2.0.0.0 - Ferret

Visual studio 2010 premium version 10.0.40219.1 sp1Rel

I am currently working on providing a small project file to be zipped for you.

Coordinator
Jun 28, 2012 at 5:11 AM

I would also love to see the xml file you're using, too.

A repo project would seriously kick ass!

Jun 28, 2012 at 3:15 PM

I am currently still awaiting a project file to be zipped but here is the xml: 

http://pastebin.com/bjXfAjZ1

Coordinator
Jul 2, 2012 at 12:49 AM

So to confirm,

you have a folder called YUICompressor under the root of your solution.

In that folder, you have a file called YUICompressor.xml .. which has all the settings in there.

yep?

Jul 2, 2012 at 3:56 PM

Yes we have a folder called YUICompressor in the root and the xml file is located in that folder.

Jul 5, 2012 at 4:06 PM

We fixed the issue. We did not use the example from this website...instead we used an example xml and post build from a third party website.

Coordinator
Jul 5, 2012 at 7:20 PM
Interesting - did you find out what the problem was?
If it is our script, we'd like to put it right...



On 5 Jul 2012, at 17:06, michael_fcc <notifications@codeplex.com> wrote:

From: michael_fcc

We fixed the issue. We did not use the example from this website...instead we used an example xml and post build from a third party website.

Jul 5, 2012 at 8:24 PM

Sorry had to look around for the site:

http://www.justaprogrammer.net/?s=yui+compressor

I don't know why but this example worked over the one in your documentation, I hope this answers some questions to the mystery.

Coordinator
Jul 6, 2012 at 1:05 PM
Edited Jul 6, 2012 at 1:09 PM

Hi,

you (and the other guy you linked to) shouldn't need to pass all those parameters on the command line

All you need do is say:

$(MSBuildBinPath)\msbuild.exe "$(ProjectDir)YUICompress.msbuild" /p:ConfigurationName=$(ConfigurationName)

and in your YUICompress.msbuild file, all paths are relative to the location of the file.  If you look at the post build example code, you see e.g. 

<JavaScriptFiles Include="Scripts\MicrosoftAjax.js"/>

Because "Scripts" is below the directory containing the YUICompress.msbuild file.

If you want access to the all properties the actual project file has access to then the simplest way is to do something slightly different - instead of adding a Post Build Event in the project properties dialog, crack open the project file itself and near the bottom you should find some import statements, such as:

<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />

After these import statements, add your own:

<Import Project="$(ProjectDir)YUICompress.msbuild" />

And then create an "AfterBuild" target (or modify tne existing one if there is one):

  <Target Name="AfterBuild">
    <CallTarget Targets="Minimize" />
  </Target>

This target will automatically be called by the build process and all properties such as $(SolutionDir), $(ConfigurationName) etc etc will be visible to the compression task.

 The only problem with this approach is that the build file is loaded and cached by Visual Studio when you open the solution, so if you make any changes to it, you have to unload and re-load the solution.

In either caseYou shouldn't have any problems then with folders containing spaces because you are not passing any folder names on the command line to msbuild.exe