简体   繁体   English

C#为什么在构建后将空的src文件夹复制到debug和release目录?

[英]C# why empty src folders are copied to the debug and release directory after build?

We are using Visual Studio 2008 professional. 我们正在使用Visual Studio 2008专业版。 We have created an entity data model in our src\\systeminfo folder. 我们在src \\ systeminfo文件夹中创建了一个实体数据模型。 Since then our release and debug folder have a empty src\\systeminfo folder. 从那时起,我们的release和debug文件夹具有一个空的src \\ systeminfo文件夹。 we don't need them. 我们不需要它们。 how to stop VS to create that empty folder structure? 如何停止VS创建该空文件夹结构? thanks 谢谢

EDIT: 编辑:

current directory tree: 当前目录树:

project\Properties
project\References
project\src
project\src\common
.
.
project\src\systeminfo
project\src\util
project\App.config
project\Settings.cs

You'd have to dig through the msbuild .target files to find out what build rule creates this folder. 您必须仔细浏览msbuild .target文件,以找出创建此文件夹的构建规则。 You might get a hint from looking at the build log if you switch it to diagnostic. 如果将构建日志切换为诊断,则可能会从查看构建日志中得到提示。 Tools + Options, Project and Solutions, Build and Run. 工具+选项,项目和解决方案,构建和运行。

A more pragmatic approach would be to just delete the folders in a post build event. 一种更实用的方法是仅在构建后事件中删除文件夹。 Like: 喜欢:

if exist "$(TargetDir)src\systeminfo" rmdir "$(TargetDir)src\systeminfo"
if exist "$(TargetDir)src" rmdir "$(TargetDir)src"

Even more pragmatic is to not worry about it... 更务实的是不要担心它。

There is an option to 'Copy to Output Directory' on the properties window. 属性窗口上有一个“复制到输出目录”选项。 Set it to 'Do not copy' for these folders 将这些文件夹设置为“不复制”

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM