如何使用YUI Compressor.Net MSBuild任务2.3.0.0 [英] How to use YUI Compressor.Net MSBuild Task 2.3.0.0

查看:106
本文介绍了如何使用YUI Compressor.Net MSBuild任务2.3.0.0的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试在网络上搜索该问题的解决方案,但似乎还不清楚.听起来好像人们已经看到了,但是解决方案似乎对我不起作用.

I have tried searching the web for a solution to this problem but it seems very unclear. It sounds like people are seeing this but the solutions don't seem to work for me.

我已经从NuGet下载并安装YUICompressor.NET.MSBuild 2.3.0.0到我的项目中. 我创建了一个MSBuild目标文件,该文件与包含的示例文件非常相似,并且作为.csproj文件的一部分存在,因此可以在AfterBuild步骤中运行它.

I have downloaded and installed YUICompressor.NET.MSBuild 2.3.0.0 from NuGet into my project. I have created an MSBuild target file that closely resembles the example file included and exists as part of my .csproj file so I can run it in the AfterBuild step.

每次尝试构建VS项目时都会遇到以下错误:

I am getting the following error everytime I try to build my VS project:



The "JavaScriptCompressorTask" task could not be loaded from the assembly SolutionDir\packages\YUICompressor.NET.MSBuild.2.3.0.0\lib\NET20\Yahoo.Yui.Compressor.Build.MsBuild.dll. 
Could not load file or assembly 'Yahoo.Yui.Compressor, Version=2.3.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.
Confirm that the  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.

我的文件夹结构如下:

\Solution
    \packages
        YUICompressor.NET.MSBuild.2.3.0.0\lib\NET20\
    \build
        ProjectFile.csproj

在csproj中,我有:

In the csproj I have:



<UsingTask TaskName="CssCompressorTask" AssemblyFile="packages\YUICompressor.NET.MSBuild.2.3.0.0\lib\NET20\Yahoo.Yui.Compressor.Build.MsBuild.dll" />
<UsingTask TaskName="JavaScriptCompressorTask" AssemblyFile="packages\YUICompressor.NET.MSBuild.2.3.0.0\lib\NET20\Yahoo.Yui.Compressor.Build.MsBuild.dll" />



<Target Name="AfterBuild">
    <ItemGroup>
        <JavaScriptFiles Include="someFile.js" />
    </ItemGroup>
    <JavaScriptCompressorTask SourceFiles="@(JavaScriptFiles)" OutputFile="build\combined.js" DeleteSourceFiles="false" CompressionType="None" ObfuscateJavaScript="false" PreserveAllSemicolons="true" />
    <JavaScriptCompressorTask SourceFiles="@(JavaScriptFiles)" OutputFile="build\combined.min.js" DeleteSourceFiles="false" CompressionType="Standard" />
</Target>

我错过了什么吗?谁能帮我?谢谢.

Am I missing something? Can anyone help me? Thank you.

推荐答案

您是否尝试直接从Codeplex下载2.3.0.0版?然后,确保Yahoo.Yui.Compressor.Build.MsBuild.dll和Yahoo.Yui.Compressor.dll驻留在同一目录中.像这样,我能够使它工作.

Did you try to download version 2.3.0.0 directly from codeplex? Then make sure that the Yahoo.Yui.Compressor.Build.MsBuild.dll and Yahoo.Yui.Compressor.dll reside in the same directory. Like this I was able to make it work.

这篇关于如何使用YUI Compressor.Net MSBuild任务2.3.0.0的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆