Jul 6, 2012 at 1:05 PM
Edited Jul 6, 2012 at 1:09 PM
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.
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):
<CallTarget Targets="Minimize" />
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