在 C# 项目中自动包含文件 [英] Auto Include Files In A C# Project

查看:51
本文介绍了在 C# 项目中自动包含文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这听起来可能并不难,但它目前正在杀死我.目前我有一个 Visual Studio 2008 C# 项目,我将它与 DAL 生成器结合使用,除了生成我可以在项目中使用以访问数据库的文件之外,它没有什么特别之处.

This may not really sound hard to do but it is currently killing me. Currently i have a Visual Studio 2008 C# Project that i use in conjunction with a DAL generator , its nothing fancy at all besides generating files that i can use in the project to access the database.

我遇到的问题是,在生成器运行并创建文件后,它们永远不会出现在我的项目中(新文件,旧的现有文件都可以).要添加它们,我必须显示隐藏文件(在 Visual Studio 中)然后手动包含所有文件.那么有没有办法自动将这些文件包含到我的项目中.

The problem i am having is that after the generator has run and the files are created they never show up in my project (new files , old existing files are fine). To add them i have to show hidden files (In visual studio) then include all of the files manually. So is there anyway to automatically include these files into my project.

提前致谢

推荐答案

在 VS2008 中:

In VS2008:

1) 右键单击​​您的项目节点.

1) Right click on your project node.

2) 选择卸载项目".

2) Select "Unload project".

3) 右键单击​​项目节点.

3) Right click on the project node.

4) 选择编辑 foo.csproj"

4) Select "Edit foo.csproj"

5) 在元素中添加一个包含使用通配符的 DAL 文件的元素,例如:

5) In the element add a element that includes your DAL files using wildcards like:

<Compile Include="DAL_*.cs" /> 

<Compile Include="DataAccessLayer\*.cs" /> 

6) 文件.保存

7) 右键单击​​项目节点.

7) Right click on the project node.

8) 选择重新加载项目".

8) Select "Reload project".

要了解有关此内容的更多信息,请阅读 MSBuild.

To learn more about this read up on MSBuild.

这篇关于在 C# 项目中自动包含文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆