|
|
I believe I have followed the instructions on how to use the YUI compressor for .NET, but I keep getting an error that says it could not load CompressorTask.
error MSB4062: The "CompressorTask" task could not be loaded from the assembly C:\Project\src\Project.UI\bin\Yahoo.Yui.Compressor.Build.MsBuild.dll. Confirm that the <UsingTask> declaration is correct, that the assembly and all its
dependencies are available, and that the task contains a public class that implements Microsoft.Build.Framework.ITask
Here is my relevant xml..
<UsingTask TaskName="CompressorTask" AssemblyFile="Project\src\Project.UI\bin\Yahoo.Yui.Compressor.Build.MsBuild.dll" />
<Target Name="Project" DependsOnTargets="Bridge;">
<ItemGroup>
<CssFiles Include="Project\src\Project.UI\Content\*.css" />
<JavaScriptFiles Include="Project\src\Project.UI\Models\*.js" />
<JavaScriptFiles Include="Project\src\Project.UI\Common\*.js" />
<JavaScriptFiles Include="Project\src\Project.UI\Services\*.js" />
<JavaScriptFiles Include="Project\src\Project.UI\ViewModels\*.js" />
<JavaScriptFiles Include="Project\src\Project.UI\View\*.js" />
</ItemGroup>
<CompressorTask
CssFiles="@(CssFiles)"
DeleteCssFiles="false"
CssOutputFile="Project\Scr\Project.UI\Content\css\Project.min.css"
JavaScriptFiles="@(JavaScriptFiles)"
JavaScriptOutputFile="Project\src\Project.UI\Scripts\Project.min.js"
LoggingType="ALittleBit"
/>
</Target>
Any suggetsions?
Thanks in advance,
Keith
|
|
|
Coordinator
Aug 21, 2012 at 10:01 PM
|
Hi,
If you are using the latest compressor code then the instructions are out of date - still a work in progress (eh PK? ;)).
The 2.x code base has separate CSS and JavaScript compressors, so the XML you quote will not work with that.
If you are using an older version, please state which one it is.
Your best bet is to download the latest source and build that and look at the samples.
If you run up the sample website, that has a page with some instructions on it, or just look at the build XML files.
From: 94stangfan
I believe I have followed the instructions on how to use the YUI compressor for .NET, but I keep getting an error that says it could not load CompressorTask.
error MSB4062: The "CompressorTask" task could not be loaded from the assembly C:\Project\src\Project.UI\bin\Yahoo.Yui.Compressor.Build.MsBuild.dll. Confirm that the <UsingTask> declaration is correct, that the assembly and all its dependencies
are available, and that the task contains a public class that implements Microsoft.Build.Framework.ITask
Here is my relevant xml..
<UsingTask TaskName="CompressorTask" AssemblyFile="Project\src\Project.UI\bin\Yahoo.Yui.Compressor.Build.MsBuild.dll" />
<Target Name="Project" DependsOnTargets="Bridge;">
<ItemGroup>
<CssFiles Include="Project\src\Project.UI\Content\*.css" />
<JavaScriptFiles Include="Project\src\Project.UI\Models\*.js" />
<JavaScriptFiles Include="Project\src\Project.UI\Common\*.js" />
<JavaScriptFiles Include="Project\src\Project.UI\Services\*.js" />
<JavaScriptFiles Include="Project\src\Project.UI\ViewModels\*.js" />
<JavaScriptFiles Include="Project\src\Project.UI\View\*.js" />
</ItemGroup>
<CompressorTask
CssFiles="@(CssFiles)"
DeleteCssFiles="false"
CssOutputFile="Project\Scr\Project.UI\Content\css\Project.min.css"
JavaScriptFiles="@(JavaScriptFiles)"
JavaScriptOutputFile="Project\src\Project.UI\Scripts\Project.min.js"
LoggingType="ALittleBit"
/>
</Target>
Any suggetsions?
Thanks in advance,
Keith
|
|
|
Coordinator
Aug 21, 2012 at 10:56 PM
|
Keith, one other thing to add to what Freeranger said :
I noticed that all your 'paths' were like this... Project\src\....
What this means is that the library will look for those places from the -current- location where the .dll exists. So this means, if the dll is in the \bin directory .. then it will try and look for
...YourMainProjectFolder\TheProject\src\Project.UI\bin\Project\src\... etc.
Try using C:\YourMainProjectFolder\TheProject\src\Project.UI\..... etc...
|
|
|
|
|
Hi,
I got the Yahoo.Yui.Compressor.Build.MsBuild.dll from NuGet. After compiling the project I see the following error
"D:\JsCssCompressor\JsCssCompressor\MsBuild\MsBuild.xml" (default target) (1) -
>
(MyTaskTarget target) ->
D:\JsCssCompressor\JsCssCompressor\MsBuild\MsBuild.xml(76,5): error MSB4062:
The "CompressorTask" task could not be loaded from the assembly D:\JsCssCompres
sor\JsCssCompressor\bin\Yahoo.Yui.Compressor.Build.MsBuild.dll. Confirm that t
he <UsingTask> declaration is correct, that the assembly and all its dependenci
es are available, and that the task contains a public class that implements Mic
rosoft.Build.Framework.ITask.
My XML file is below
**********************************************
<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/MsBuild/2003">
<UsingTask TaskName="CompressorTask"
AssemblyFile="D:\JsCssCompressor\JsCssCompressor\bin\Yahoo.Yui.Compressor.Build.MsBuild.dll" />
<Target Name="MyTaskTarget">
<ItemGroup>
<JavaScriptFiles Include="C:\Work\Purchase_Flow\eBizSol_App\Release\WebSites\Websites\McAfee.Consumer.Website\UIDesign\LegacySite\Scripts\FlexDashboard\AddDevice.js"/>
</ItemGroup>
<CompressorTask
JavaScriptCompressionType="YuiStockCompression"
JavaScriptFiles="@(JavaScriptFiles)"
ObfuscateJavaScript="True"
PreserveAllSemicolons="False"
DisableOptimizations="Nope"
EncodingType="Default"
DeleteJavaScriptFiles="false"
LineBreakPosition="-1"
JavaScriptOutputFile="C:\Work\Purchase_Flow\eBizSol_App\Release\WebSites\Websites\McAfee.Consumer.Website\UIDesign\LegacySite\Scripts\FlexDashboard\MAA2.0.js"
LoggingType="ALittleBit"
ThreadCulture="en-us"
IsEvalIgnored="false"
/>
</Target>
</Project>
*********************************************
Any idea why I am getting the compilation error?.
Deepak
|
|
|
Coordinator
Sep 20, 2012 at 2:30 AM
|
Hi Deepakkb.
ok the first thing i want to confirm with you are these things :-
1. Are you sure the file is located at : D:\JsCssCompressor\JsCssCompressor\bin\Yahoo.Yui.Compressor.Build.MsBuild.dll
2. What is the version of that file? Right click the file => properties =>Details
|
|
|
|
|
I'm getting the same error...
|
|
|
|
|
The file version for Yahoo.Yui.Compressor.Build.MsBuild is 2.0.0.0
|
|
|
|
|
The MsBuild version is following: -
Microsoft (R) Build Engine Version 4.0.30319.1
[Microsoft .NET Framework, Version 4.0.30319.269]
Copyright (C) Microsoft Corporation 2007. All rights reserved.
The sample project is in VS2010 and using .NET 4.0
|
|
|
Coordinator
Sep 21, 2012 at 6:55 AM
|
Looks like exactly the same problem 94stangfan had, who started this thread. The documentation on this site is out of date - PureKrome is working on updating it,
In the mean time, download the latest source code and look at the example web project included in that. This example works and, if you run it, the web page provides some documentation on how it works.
|
|
|
|
|
I could not download de example web project. My firewall said that there's a virus:
Accesss to the page has been denied
because the following virus was detected
Clamd: Heuristics.Broken.Executable
|
|
|
Coordinator
Sep 21, 2012 at 1:30 PM
|
Strange - there are no executables in the source code download....
Ok, look at this source file directly:
http://yuicompressor.codeplex.com/SourceControl/changeset/view/78915#1293368
|
|
|
|
|
Hi freeranger,
After downloading the source code on my machine, when I run the following command, it works fine.
C:\Users\dbal.MCAFEE\Desktop\yuicompressor-78915\Documentation\MsBuild Example>m
sbuild.exe MsBuildSample.xml
The javascript and css files are getting compressed. I think the documentation needs to be updated on the web site about the msbuild.xml.
Deepak
|
|
|
Coordinator
Sep 21, 2012 at 5:58 PM
|
Thanks for letting us know that works for you. We are aware the documentation needs to be sorted....
|
|
|
Feb 15 at 11:06 AM
Edited Feb 15 at 11:06 AM
|
I have installed the latest YUICompressor.NET and YUICompressor.NET.MSBuild and installed through the http://yuicompressor.codeplex.com/ and the xml file file is
<?xml version="1.0" encoding="utf-8" ?>
<Project xmlns="http://schemas.microsoft.com/developer/MsBuild/2003">
<UsingTask
TaskName="CompressorTask"
AssemblyFile="..\..\lib\yui\Yahoo.Yui.Compressor.Build.MsBuild.dll" />
<PropertyGroup>
<JavaScriptOutputFile Condition=" '$(JavaScriptOutputFile)'=='' ">..\scripts-min\myfile.min.js</JavaScriptOutputFile>
</PropertyGroup>
<Target Name="MyTaskTarget">
<ItemGroup>
<JavaScriptFiles Include="$(SourceLocation)..\scripts\myfile.js"/>
</ItemGroup>
<CompressorTask
CssFiles="@(CssFiles)"
DeleteCssFiles="false"
CssOutputFile="$(CssOutputFile)"
CssCompressionType="YuiStockCompression"
JavaScriptFiles="@(JavaScriptFiles)"
ObfuscateJavaScript="True"
PreserveAllSemicolons="False"
DisableOptimizations="Nope"
EncodingType="Default"
DeleteJavaScriptFiles="false"
LineBreakPosition="-1"
JavaScriptOutputFile="$(JavaScriptOutputFile)"
LoggingType="ALittleBit"
ThreadCulture="en-au"
/>
</Target>
</Project>
but it is still showing the error
Error 18 The "CompressorTask" task could not be loaded from the assembly D:\Projects\YUI....\lib\yui\Yahoo.Yui.Compressor.Build.MsBuild.dll. Could not load file or assembly 'Yahoo.Yui.Compressor, Version=2.2.0.0, Culture=neutral, PublicKeyToken=null'or one of its dependencies. The system cannot find the file specified. Confirm that the <UsingTask> declaration is correct, that the assembly and all its dependencies are available, and that the task contains a public class that implements Microsoft.Build.Framework.ITask.
|
|
|
Coordinator
Feb 15 at 11:26 AM
|
Hello,
It looks like you are trying to use the lastest code with an old version of an msbuild file.
Since 2.x, the compressor task has been broken out into separate css and javascript compressors - see the documentation pages or download samples for examples of how to use msbuild in 2.x versions of YUICompressor.Net
thanks
|
|
|
|
|
Thanks for the reply. I have changed the xml file in the below format
<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/MsBuild/2003">
<UsingTask TaskName="CssCompressorTask" AssemblyFile="..\bin\Yahoo.Yui.Compressor.Build.MsBuild.dll" />
<UsingTask TaskName="JavaScriptCompressorTask" AssemblyFile="..\bin\Yahoo.Yui.Compressor.Build.MsBuild.dll" />
<PropertyGroup>
<CSSOutputFile Condition=" '$(CSSOutputFile)'=='' ">..\Min\site.min.css</CSSOutputFile>
<JavascriptOutputFile Condition=" '$(JavascriptOutputFile)'=='' ">..\Min\jquery.min.js</JavascriptOutputFile>
</PropertyGroup>
<Target Name="Minify">
<ItemGroup>
<CssFiles Include="..\Content\Site.css"/>
<JavaScriptFiles Include="..\Scripts\jquery-1.6.2.js"/>
</ItemGroup>
<CssCompressorTask
SourceFiles="@(CssFiles)"
DeleteSourceFiles="false"
OutputFile="$(CSSOutputFile)"
CompressionType="Standard"
LoggingType="Info"
PreserveComments="false"
LineBreakPosition="-1"
/>
<JavaScriptCompressorTask
SourceFiles="@(JavaScriptFiles)"
DeleteSourceFiles="false"
OutputFile="$(JavascriptOutputFile)"
CompressionType="Standard"
ObfuscateJavaScript="True"
PreserveAllSemicolons="False"
DisableOptimizations="No"
EncodingType="Default"
LineBreakPosition="-1"
LoggingType="Info"
ThreadCulture="en-au"
IsEvalIgnored="false"
/>
</Target>
</Project>
But it is showing the below error
The "JavaScriptCompressorTask" task could not be loaded from the assembly D:\Projects\YUI..\bin\Yahoo.Yui.Compressor.Build.MsBuild.dll. Could not load file or assembly 'Yahoo.Yui.Compressor, Version=2.2.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified. Confirm that the <UsingTask> declaration is correct, that the assembly and all its dependencies are available, and that the task contains a public class that implements Microsoft.Build.Framework.ITask. D:\Projects\YUI\myfile.xml
|
|
|
Coordinator
Feb 18 at 8:26 AM
|
Hi pankajsaha,
I have a few questions - please answer them.
- The -exact- full path of where the xml file is located.
- The -exact- full path of where Yahoo.Yui.Compressor.Build.MsBuild.dll. is located
- The -exact- full path of the core Yahoo.Yui.Compressor dll
-
The -exact- full path of where you are 'running' msbuild against that xml file.
cheers!
|
|
|
|
|
I got the solution. Previously I have added the old versions and added only new version of Yahoo.Yui.Compressor.Build.MsBuild.dll. I have removed all the old version files and again added new versions and it is working fine. The files are added here are
EcmaScript.NET.dll
Iesi.Collections.dll
NAnt.Core.dll
Yahoo.Yui.Compressor.Build.MsBuild.dll
Yahoo.Yui.Compressor.dll
Thanks all :)
|
|