Visual Studio 2010:如何从"构建部署包"中排除文件夹/文件?

Fer*_*ryt 8 visual-studio-2010

是否可以从VS 2010中的"构建部署包"功能中排除特定文件或文件夹?

在VS 2008中,可以使用Web部署包,遗憾的是,该项目在VS2010中不可用.

Sha*_*men 9

我还需要排除一些文件,我想从部署中删除程序集.xml文件(我不需要它们在服务器上),我在网上找不到任何东西所以我决定自己寻找它.

在深入了解MsPublish的msbuild后,我找到了它,你需要在你的项目中设置以下内容(编辑.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>
Run Code Online (Sandbox Code Playgroud)