ExcludeFromBuild 项目组应该如何在 Web 部署项目中工作?
我在 Web 部署项目的 PreBuild 目标中添加了一个用于 ExcludeFromBuild 项目的 ItemGroup:
<ItemGroup>
<ExcludeFromBuild Include="$(SourceWebPhysicalPath)\Test\**\*.*" />
</ItemGroup>
构建后,输出中的程序集仍然包含来自 ~/Test 中文件的已编译类。这不是我所期望的。
以下是 在 Visual Studio 2005 中使用 Web 部署项目 的片段微软软件定义网络:
例如,添加以下内容 部分到网络 部署项目,可以排除 测试和图像文件夹 构建过程:
; 如果您有测试代码,这很有用 在网站项目中应该 不包括在分期或 发布版本。
但似乎对我来说并不适用。我错过了一些明显的事情吗?
I added an ItemGroup for ExcludeFromBuild items in the PreBuild target in my Web Deployment project:
<ItemGroup>
<ExcludeFromBuild Include="$(SourceWebPhysicalPath)\Test\**\*.*" />
</ItemGroup>
After the build the assembly in the output still contains the compiled classes from the files in ~/Test. That's not what I expected.
Here is a snippet from Using Web Deployment Projects with Visual Studio 2005 on MSDN:
For example, by adding the following
section to a Web
Deployment project, you can exclude
the Test and Images folder from the
build process:<ItemGroup> <ExcludeFromBuild Include="$(SourceWebPhysicalPath)\Test\**\*.*"/> <ExcludeFromBuild Include="$(SourceWebPhysicalPath)\Images\**\*.*"/> </ItemGroup>
This is useful if you have test code
in the Web site project that should
not be included in the staging or
release builds.
Seems not work that way for me though. Am I missing something obvious?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
没关系,我已经发现问题了。 ExcludeFromBuild 项组在 _CopyBeforeBuild 目标中进行评估,该目标称为 BeforeBuild 目标之前。
哎哟!
Never mind, I have found the problem. The ExcludeFromBuild item group is evaluated in the _CopyBeforeBuild target, which is called before the BeforeBuild target.
Doh!