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

查看:106
本文介绍了我们如何将由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)\Microsoft\MicrosoftAjax\ajaxmin.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/WebDeploymentToolMSDeployBuildPackageIn includedExtraFilesOrExclusionSpecificFiles .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>

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

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?

推荐答案

您错过了目标目录,因此您要做的就是为脚本文件夹,源文件和目标文件中的每个脚本创建对文件夹,以确保您没有根据项目的脚本文件夹结构,将所有最小文件复制到项目中的每个文件夹,无论我写文章的方式以及操作者是谁,也可以下载执行此操作的项目, 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天全站免登陆