Edit 4 (Edit 1 to 3 removed as they where solved)
My last problem is that I would like multiple targets but it does not seem to work. I have to stick them all into the same target what kinda sucks since it would nice to different names so I got to change something I can just look at the target name.
Hi
I am trying to get my MsBuild and it works….if all my stuff is in the same target tag. If I have multiple tags it only does the first one and that’s it. None of the other targets are done.
<Target Name="Test1">
<ItemGroup>
<JavaScriptFiles Remove="@(JavaScriptFiles)" />
<JavaScriptFiles Include="..\PathHere\Javascript.js"/>
</ItemGroup>
<CompressorTask
JavaScriptFiles="%(JavaScriptFiles.Identity)"
ObfuscateJavaScript="True"
PreserveAllSemicolons="False"
DisableOptimizations="Nope"
EncodingType="Default"
DeleteJavaScriptFiles="false"
LineBreakPosition="-1"
JavaScriptOutputFile="../Path/Here/(JavaScriptFiles.FileName).min.js"
LoggingType="ALittleBit"
ThreadCulture="en-au"
IsEvalIgnored="false"
/>
<ItemGroup>
<JavaScriptFiles Remove="@(JavaScriptFiles)" />
<JavaScriptFiles Include="..\PathHere\Javascript2.js"/>
</ItemGroup>
<CompressorTask
JavaScriptFiles="%(JavaScriptFiles.Identity)"
ObfuscateJavaScript="True"
PreserveAllSemicolons="False"
DisableOptimizations="Nope"
EncodingType="Default"
DeleteJavaScriptFiles="false"
LineBreakPosition="-1"
JavaScriptOutputFile="../Path/Here/%(JavaScriptFiles.FileName).min.js"
LoggingType="ALittleBit"
ThreadCulture="en-au"
IsEvalIgnored="false"
/>
</Target>
So the above works. If I do this
<Target Name="Test2">
<ItemGroup>
<JavaScriptFiles Remove="@(JavaScriptFiles)" />
JavaScriptFiles Include="..\PathHere\Javascript3.js"/>
</ItemGroup>
<CompressorTask
JavaScriptFiles="%(JavaScriptFiles.Identity)"
ObfuscateJavaScript="True"
PreserveAllSemicolons="False"
DisableOptimizations="Nope"
EncodingType="Default"
DeleteJavaScriptFiles="false"
LineBreakPosition="-1"
JavaScriptOutputFile="../Path/Here/%(JavaScriptFiles.FileName).min.js"
LoggingType="ALittleBit"
ThreadCulture="en-au"
IsEvalIgnored="false"
/>
</Target>
Then the first target will go and the above one will do nothing.
I’m not sure, but it looks like there is some confusion about MSBuild variable access. There are three ways to access variables with msbuild.
It looks like you actually want to be using
@()where you are using%()but I’ll confess I’m having a hard time understanding exactly what your problem is. You said it “will do nothing” but chances are it’s doing something, even if it doesn’t appear to be doing anything.more here