我有我想保持在该项目,但不包括在发布某些文件夹。
那可能吗?
Michael是完全正确的,经过编辑的.csproj文件,你可以手动从被公布排除文件/文件夹。
如果你不想用的.csproj文件乱七八糟的一个更简单的方法就是要突出VS解决方案资源管理里面的文件(S)。在属性面板中更改构建从“内容”为“无”行动。
这样,您就不必从溶液中卸载该项目,加载的.csproj,并添加一条线,你添加一个并不需要被公开,而是达到同样用3鼠标点击每个新文件。
(假设你已经设置发布选项卡下的“运行该应用程序只需要发布的文件”)
如果它是一个网站项目,您可以排除某些文件夹和/或文件,如下所示(请参阅要素ExcludeFoldersFromDeployment和ExcludeFilesFromDeployment):
<?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>
<WebPublishMethod>FileSystem</WebPublishMethod>
<LastUsedBuildConfiguration>Release</LastUsedBuildConfiguration>
<LastUsedPlatform>Any CPU</LastUsedPlatform>
<SiteUrlToLaunchAfterPublish />
<LaunchSiteAfterPublish>True</LaunchSiteAfterPublish>
<ExcludeApp_Data>True</ExcludeApp_Data>
<publishUrl>D:\YAZILIM\Adopen.2015\PreCompiledWeb</publishUrl>
<DeleteExistingFiles>True</DeleteExistingFiles>
<PrecompileBeforePublish>True</PrecompileBeforePublish>
<EnableUpdateable>True</EnableUpdateable>
<DebugSymbols>False</DebugSymbols>
<WDPMergeOption>MergeAllOutputsToASingleAssembly</WDPMergeOption>
<UseMerge>True</UseMerge>
<SingleAssemblyName>AdoIntranet</SingleAssemblyName>
<ExcludeFoldersFromDeployment>customobjects;uploads</ExcludeFoldersFromDeployment>
<ExcludeFilesFromDeployment>app.config</ExcludeFilesFromDeployment>
</PropertyGroup>
</Project>
你可以做一个“查找和替换”在Web.cspoj文件,以快速消除来自发布/部署过程中的特定文件夹
像这样;
<Content Include="Uploads/
至
<None Include="Uploads/
你可以做的另一种方法是你可以隐藏那些不需要被得到发表Windows资源管理器的文件夹(不是最好的解决办法,但如果你有大组仍然需要在发展框图像的作品)。
<ItemGroup> <Content Update="Data\CernainFolder\*.*"> <CopyToPublishDirectory>Never</CopyToPublishDirectory> </Content> </ItemGroup>
这应该很好地工作
因为这个问题被标记为ASP,没有.proj
文件与混乱。随着VS2015,还有另外一个有用的文件,而不是:website.publishproj
。而this Asp.Net article on excluding files and folders提到.wpp.targets
文件。
所有这些文件包含<ItemGroup>
元素,可能有一个像<ExcludeFromPackageFolders>
元素。由于这些似乎记载功能,只需使用它们,不要感到内疚黑客或“捣乱”。对我来说,使用环节和website.publishproj
文件的简单的指令不包括目录工作就像一个魅力!