Windows Vista Beta | WinVistaBeta.com - Message | MSBuild questions

November 19, 2008  
Subject: MSBuild questions
Group: microsoft.public.vstudio.general
Date: 7/23/2008 10:43:24 AM
From: trullock@googlemail.com

Hi,

I'm trying to integrate a javascript compressor into my web
application project so it compresses javascript files on PUBLISH only,
however ive got a few problems.

i've been reading things such as this:
http://www.coderjournal.com/2008/05/how-to-create-a-yui-compressor-msbuild-task/
which make sense to me, i think im just missing some background info;
so if someone could fill me in that would be ace :)

I know how to write the custom msbuild task, what i'm stuck with are
the steps to get it working...

Firstly, how do i tell MSBuild to only pass .js files to my task?
I've seen examples suggesting putting something like this in
the .csproj file:

<ItemGroup>
<JavaScriptContent Include="**\*.js" />
</ItemGroup>

however when i add this, my project then contains two references to
each JS file, one with the buildaction of "Content" and another with
the build action of "JavaScriptContent". Removing duplicates is not an
option because there are millions, and when i add a new file its added
as content and i cant have to rely on my memory to change the
buildaction. What can i do about this?

Secondly I've got a problem getting my task to run on publish, for
possibly two reasons...

im using <Target Name="AfterPublish"> , however this doesnt seem to
run the Task (AfterBuild works). Is that a valid target name? i
thought it was :s

lastly, what is the name of the macro i need to use to get the
published directory, is it "$(TargetDir)..\" ?

Thanks for any advice

Andrew

Back