Visual Studio 2010:如何从“构建部署包"中排除文件夹/文件? [英] Visual Studio 2010: How to exclude folder/files from "Build Deployment Package"?
问题描述
是否可以从 VS 2010 的构建部署包"功能中排除特定文件或文件夹?
Is it possible to exclude specific files or folders from "Build Deployment Package" function in VS 2010?
在 VS 2008 中可以使用 Web 部署包,不幸的是这个项目在 VS2010 中不可用.
In VS 2008 it was possible with Web Deployment package, unfortunately this project is not available in VS2010.
推荐答案
我还需要排除一些文件,我想从部署中删除程序集 .xml 文件(我在服务器上不需要它们),我可以在网上找不到任何东西,所以我决定自己寻找.
I need to exclude some files also, I want to remove assemblies .xml files from the deploy (I don't need them on the server), I couldn't find anything on the web so I decide to look for it on my own.
在我找到了 MsPublish 的 msbuild 后,您需要在项目中设置以下内容(手动编辑 .csproj):
After digging into the msbuild of the MsPublish I found it, you need to setup the following in your project (edit manualy the .csproj):
<ItemGroup>
<!-- This will exclude the .xml files from the bin folder -->
<ExcludeFromPackageFiles Include="$(OutputPath)*.xml" />
<!-- This will exclude the tmp folder from the bin folder -->
<ExcludeFromPackageFolders Include="$(OutputPath)tmp" />
</ItemGroup>
这篇关于Visual Studio 2010:如何从“构建部署包"中排除文件夹/文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!