【问题标题】:How can I exclude the bin folder from Visual Studio publish?如何从 Visual Studio 发布中排除 bin 文件夹?
【发布时间】:2018-01-25 22:40:48
【问题描述】:

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

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

下面是我的 .pubxml 文件。请注意,“bin”列在 ExcludeFoldersFromDeployment 元素中。此处列出的所有其他文件夹都按预期排除,但仍会复制此 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>

【问题讨论】:

    标签: c# asp.net visual-studio visual-studio-2015


    【解决方案1】:

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

    <ExcludeFoldersFromDeployment>bin<
    

    【讨论】:

    • 编辑问题以明确我已经这样做了,但它不起作用
    【解决方案2】:

    我刚刚在我的发布配置文件中插入了&lt;ExcludeFoldersFromDeployment&gt;bin&lt;/ExcludeFoldersFromDeployment&gt;,它没有包含 bin 文件夹

    【讨论】:

    • 什么版本的 Visual Studio?我正在使用 VS 2015,并且还在使用像 &lt;ExcludeFoldersFromDeployment&gt;bin;folder1;folder2&lt;/ExcludeFoldersFromDeployment&gt; 这样的文件夹列表。这对我不起作用
    • 我也在用VS 2015
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2011-08-31
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-09-19
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多