如何从 Visual Studio 发布中排除 bin 文件夹?



我想排除 bin 文件夹被复制到发布目录。

使用 Visual Studio 2015,Asp.Net Web 应用程序项目

下面是我的.pubxml文件。请注意,"bin"列在 ExcludeFolderFromDeployment 元素中。按预期排除了此处列出的所有其他文件夹,但仍会复制此 bin 文件夹!

我想 bin 目录是不同的,因为它不是项目的一部分,而是构建输出的一部分。我的构建输出路径指向与我的发布不同的目录,并且工作正常。为什么仍然将 bin 复制到发布输出目录?可以排除吗??

<?xml version="1.0" encoding="utf-8"?>
<!--
This file is used by the publish/package process of your Web project. You can customize the behavior of this process
by editing this MSBuild file. In order to learn more about this please visit http://go.microsoft.com/fwlink/?LinkID=208121. 
-->
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<ExcludeFilesFromDeployment>Web.config;Default.aspx;packages.config</ExcludeFilesFromDeployment>
<ExcludeFoldersFromDeployment>bin;js;TestingUtils;TestPages;UI</ExcludeFoldersFromDeployment>
<WebPublishMethod>FileSystem</WebPublishMethod>
<LastUsedBuildConfiguration>Release</LastUsedBuildConfiguration>
<LastUsedPlatform>Any CPU</LastUsedPlatform>
<SiteUrlToLaunchAfterPublish />
<LaunchSiteAfterPublish>True</LaunchSiteAfterPublish>
<ExcludeApp_Data>False</ExcludeApp_Data>
<publishUrl>C:website</publishUrl>
<DeleteExistingFiles>True</DeleteExistingFiles>
</PropertyGroup>
</Project>

我刚刚在我的发布配置文件中插入了<ExcludeFoldersFromDeployment>bin</ExcludeFoldersFromDeployment>,它不包括 bin 文件夹

您可以在 XML 发布配置文件中使用以下标记:

<ExcludeFoldersFromDeployment>bin<

最新更新