Using the following msbuild config:
<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/MsBuild/2003">
<UsingTask
TaskName="CompressorTask"
AssemblyFile="Yahoo.Yui.Compressor.dll" />
<PropertyGroup>
<JavaScriptOutputFile Condition=" '$(JavaScriptOutputFile)'=='' ">..\..\site.se\javascript\javascript.min.js</JavaScriptOutputFile>
</PropertyGroup>
<Target Name="CompressorTask">
<ItemGroup>
<JavaScriptFiles Include="..\..\site.se\javascript\javascript.js"/>
</ItemGroup>
<CompressorTask
JavaScriptFiles="@(JavaScriptFiles)"
ObfuscateJavaScript="True"
PreserveAllSemicolons="True"
DisableOptimizations="False"
EncodingType="utf-8"
DeleteJavaScriptFiles="false"
LineBreakPosition="-1"
JavaScriptOutputFile="$(JavaScriptOutputFile)"
LoggingType="HardcoreBringItOn"
ThreadCulture="en-us"
IsEvalIgnored="false" />
</Target>
</Project>
I get the following error:
Scripts.xml(14,11): error MSB4067: -element under
-element is unknown. (translated from swedish)
I’m using the 32bit .NET 2.0 version of MsBuild.
What’s wrong?
You can’t put an
ItemGroupin a target with MSBuild for .NET 2. You have to use theCreateItemtask or put it outside of the target. In your case you don’t seem to need to dynamically create theJavaScriptFilesitem so you just have to put it outside of the target.Outside:
Using
CreateItem: