我们如何将ajaxmin创建的文件包含在MSBuild创建的msdeploy包中 [英] How can we include the files created by ajaxmin in the msdeploy package created by MSBuild

查看:20
本文介绍了我们如何将ajaxmin创建的文件包含在MSBuild创建的msdeploy包中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们使用 ajaxmin 从我们所有的 .js 文件创建 .min.js 文件.我们编辑了项目的 .csproj 文件并添加了以下内容:

We use ajaxmin to create .min.js files from all our .js files. We have edited the .csproj file of the project and added following:

<Import Project="$(MSBuildExtensionsPath32)MicrosoftMicrosoftAjaxajaxmin.tasks" />
<Target Name="AfterBuild">
    <ItemGroup>
        <JS Include="***.js" Exclude="***.min.js" />
    </ItemGroup>
    <AjaxMin JsSourceFiles="@(JS)" JsSourceExtensionPattern=".js$" JsTargetExtension=".min.js" />
</Target>

当我们在工作站上构建站点并且可以在站点中使用 .min.js 文件时,这非常有效.当我们在此任务中检查此项目时,它也在 msbuild 服务器上运行,但 ajaxmin 生成的 .min.js 文件不会复制到我们使用的 tfs2010 Rolling Build 的放置位置.这些 .min.js 文件也不包含在我们在此滚动构建期间创建的包中,该包也被复制到放置位置.只有包含在项目中的文件用于打包并复制到放置位置.

This works great when we build the site on our workstation and the .min.js files can be used in the site. When we check this project in this task runs also on the msbuild server but the .min.js files generated by ajaxmin are not copied to the drop location of the tfs2010 Rolling Build we use. These .min.js files are also not included into the package we create during this rolling build and which is also copied to the drop location. Only the files included into the project are used for the package and copied to the drop location.

我们用来创建包的 MSBuild 参数如下:

The MSBuild Arguments we use to create the package are the following:

/p:DeployOnBuild=True /p:DeployTarget=MsDeployPublish /p:MSDeployPublishMethod=InProc /p:CreatePackageOnPublish=True /p:MSDeployServiceURL=localhost

我尝试了几种方法,例如添加额外的构建任务以将所有 .min.js 文件复制到创建包的位置.我还尝试了以下网址 http://sedodream.com/2010/05/01/WebDeploymentToolMSDeploySpecBuildPackageInducingExtraFilesOrExducingSpecificFiles.aspx".aspx 以在我的 .csproj 文件中包含以下文件:

I've tried several things as adding an extra build task to copy all the .min.js files to the location where the package is created. I tried also the following url http://sedodream.com/2010/05/01/WebDeploymentToolMSDeployBuildPackageIncludingExtraFilesOrExcludingSpecificFiles.aspx to include this files with the following in my .csproj file:

<PropertyGroup>
    <CopyAllFilesToSingleFolderForPackageDependsOn>
      CustomCollectFiles;
      $(CopyAllFilesToSingleFolderForPackageDependsOn);
    </CopyAllFilesToSingleFolderForPackageDependsOn>
</PropertyGroup>
<Target Name="CustomCollectFiles">
    <ItemGroup>
        <_CustomFiles Include="***.min.js" />
        <FilesForPackagingFromProject  Include="%(_CustomFiles.Identity)">
            <DestinationRelativePath>%(RecursiveDir)%(Filename)%(Extension)</DestinationRelativePath>
        </FilesForPackagingFromProject>
    </ItemGroup>
</Target>

有没有其他人也有这个问题,或者有没有人知道如何将 *.min.js 文件包含在 msdeploy 包中并将文件复制到放置位置?

Has anyone else also this problem or does anyone have an idea how to include the *.min.js files in the msdeploy package and make the files copy to the drop location?

推荐答案

您错过了目标目录,因此您要做的就是为脚本文件夹、源和目标中的每个脚本创建成对文件夹,以确保您没有根据您项目的脚本文件夹结构,将所有min文件复制到您项目中的每个文件夹中,我怎么写文章以及谁怎么做,您也可以下载这样做的项目,http://mohamedradwan.wordpress.com/2010/11/12/how-to-include-minify-files-or-custome-files-with-web-pagckage-or-ms-deploy-package/

You missed the destination directory so all you have to do is creating pair folders for each script in your script folder, source and destination to make sure you didn't copy all the min files to each folder in your project according to the script folder structure of your project, any way I write an article and who how to do that, you can also download project that do that, http://mohamedradwan.wordpress.com/2010/11/12/how-to-include-minify-files-or-custome-files-with-web-pagckage-or-ms-deploy-package/

谢谢

这篇关于我们如何将ajaxmin创建的文件包含在MSBuild创建的msdeploy包中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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