使用msbuild从网站部署中排除文件 [英] Exclude files from web site deployment with msbuild

查看:93
本文介绍了使用msbuild从网站部署中排除文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个使用msbuild部署的网站项目.在项目中,构建需要一些文件和文件夹(例如,web.config零件替换文件),但我不想将其部署到目标站点.

I have a web site project that I deploy using msbuild. In the project there are some files and folders that are needed for the build (e.g. the web.config part replacement files) but that I don't want to deploy to the target site.

我能想到的最好的方法是删除这些文件的构建后目标,但我想知道是否有一种方法可以将这些文件不复制到输出文件夹中.

The best I could think of is a post-build target that removes these files, but I'd like to know if there is a way to have these files not copied to the output folder.

推荐答案

检查我试图排除未缩小版本的javascript,并仅在发布时使用缩小版本(我正在删除大型javascript和chirp.config),这仅是调试所需要的.

I was trying to exclude the un-minified version of the javascripts, and use only the minified version when published (I'm removing large javascripts and chirp.config) its only needed for debug.

只需按照链接上的说明将其放在Project文件中即可.

just put this on the Project file as stated on the link.

<ItemGroup>
    <ExcludeFromPackageFolders Include="Scripts\large">
      <FromTarget>Project</FromTarget>
    </ExcludeFromPackageFolders> 


    <ExcludeFromPackageFiles Include="Scripts\mash.js.chirp.config" />  
    <ExcludeFromPackageFiles Include="Content\mash.js.chirp.config" />
  </ItemGroup>

已发布的网站将不包含以下内容:

The published site will not include the following:

  • 脚本\大
  • mash.js.chirp.config

这篇关于使用msbuild从网站部署中排除文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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