如何为现有的c项目创建VS解决方案,以便VS自动选择新文件?

时间:2022-03-23 15:02:19

I would like to port an embedded application to x86 to create an emulator. We decided to give VS2008 a try but I'm not sure how to make vs to understand our existing directory structure:

我想将嵌入式应用程序移植到x86来创建一个模拟器。我们决定尝试VS2008,但我不确定如何让vs了解我们现有的目录结构:

  • arch/
    • arch/hcs08 -- HAL implementation
    • arch / hcs08 - HAL实现

    • arch/include -- public interface of HAL
    • arch / include - HAL的公共接口

    • arch/x86 -- here should goes the emulation layer
    • arch / x86 - 这里应该是仿真层

  • arch / arch / hcs08 - HAL实现arch / include - HAL arch / x86的公共接口 - 这里应该是仿真层

  • os/
    • os/src -- source for os layer
    • os / src - os层的源代码

    • os/include -- public interface of OS
    • os / include - 操作系统的公共接口

  • os / os / src - os layer os / include的源代码 - OS的公共接口

  • apps/ -- embedded applications
    • apps/app1/src -- app1
    • apps / app1 / src - app1

    • apps/app2/src -- app2
    • apps / app2 / src - app2

  • apps / - 嵌入式应用程序app / app1 / src - app1 apps / app2 / src - app2

I would like to have 3 projects:

我想有3个项目:

  • arch & os - library project, that contains everything in os/, arch/include/ and arch/x86/*
  • arch&os - 库项目,包含os /,arch / include /和arch / x86 / *中的所有内容

  • app1 - console app project, that contains everything in apps/app1/*
  • app1 - 控制台应用程序项目,包含apps / app1 / *中的所有内容

  • app2 - console app project, that contains everything in apps/app1/*
  • app2 - 控制台应用程序项目,包含apps / app1 / *中的所有内容

I've created the above structure by importing files manually one by one, but obviously vs doesn't pick new files automatically and my project is flat (no folders)

我通过逐个手动导入文件创建了上述结构,但显然vs不自动选择新文件而且我的项目是平的(没有文件夹)

OS & application layers are under constant development so adding new files is really irritating.

操作系统和应用程序层正在不断发展,因此添加新文件真的很烦人。

Is there any way to make VS to pick all new files automatically and keep the directory structure?

有没有办法让VS自动选择所有新文件并保留目录结构?

I know that I can easily to the above in Eclipse CDT but as I said we would like to try VS2008.

我知道我可以轻松地在Eclipse CDT中使用上述内容,但正如我所说,我们想尝试VS2008。

2 个解决方案

#1


Piotr, You have to choose "Show all files" option from solution explorer. It will show you all files in your project directories structure. The files not included in project (modified outside VS, copied etc) should appear as pale white objects. Everything to do is to include them into project by clicking the menu option on context menu for selected item. This option adds also whole directory structure recursively. Of course, you can also exclude the files unnecessary in project.

Piotr,您必须从解决方案资源管理器中选择“显示所有文件”选项。它将显示项目目录结构中的所有文件。项目中未包含的文件(在VS外部修改,复制等)应显示为淡白色对象。所有要做的就是通过单击所选项目的上下文菜单上的菜单选项将它们包含到项目中。此选项还递归地添加整个目录结构。当然,您也可以排除项目中不必要的文件。

The Visual Studio uses XML files to handle every solution and project content, thus its behavior differs a little from Eclipse which AFAIK included whole filesystem directory. If you wish to incorporate the file into project, you have to do it on your demand or copy it directly to solution explorer. Of course, if you wish to use SVN it's a good idea to choose VS plugin which will do the work without bothering you. (i.e AnkhSVN - open source and free).

Visual Studio使用XML文件来处理每个解决方案和项目内容,因此它的行为与Eclipse有所不同,而AFAIK包含整个文件系统目录。如果您希望将文件合并到项目中,则必须根据需要执行此操作或将其直接复制到解决方案资源管理器。当然,如果你想使用SVN,最好选择VS插件,它可以在不打扰你的情况下完成工作。 (即AnkhSVN - 开源和免费)。

You can also develop your own "watchdog" plugin to refresh the content ;)

您还可以开发自己的“看门狗”插件来刷新内容;)

Best regards, J.

最好的问候,J。

#2


VS2008, off-course can have directory structure for the project. But you need to manually create it. To do this, right-click on you project, and their you will find "add folder" menu. You can create the same folder set as followed by your project.

VS2008,off-course可以有项目的目录结构。但您需要手动创建它。要执行此操作,请右键单击您的项目,然后您将找到“添加文件夹”菜单。您可以创建项目所遵循的相同文件夹集。

Automatic file addition: I have not heard of this. Probably its not possible. Unless you are adding too many files to your project, adding files manually is not that difficult in VS ..

自动添加文件:我没有听说过这个。可能它不可能。除非您向项目添加太多文件,否则在VS中手动添加文件并不困难。

#1


Piotr, You have to choose "Show all files" option from solution explorer. It will show you all files in your project directories structure. The files not included in project (modified outside VS, copied etc) should appear as pale white objects. Everything to do is to include them into project by clicking the menu option on context menu for selected item. This option adds also whole directory structure recursively. Of course, you can also exclude the files unnecessary in project.

Piotr,您必须从解决方案资源管理器中选择“显示所有文件”选项。它将显示项目目录结构中的所有文件。项目中未包含的文件(在VS外部修改,复制等)应显示为淡白色对象。所有要做的就是通过单击所选项目的上下文菜单上的菜单选项将它们包含到项目中。此选项还递归地添加整个目录结构。当然,您也可以排除项目中不必要的文件。

The Visual Studio uses XML files to handle every solution and project content, thus its behavior differs a little from Eclipse which AFAIK included whole filesystem directory. If you wish to incorporate the file into project, you have to do it on your demand or copy it directly to solution explorer. Of course, if you wish to use SVN it's a good idea to choose VS plugin which will do the work without bothering you. (i.e AnkhSVN - open source and free).

Visual Studio使用XML文件来处理每个解决方案和项目内容,因此它的行为与Eclipse有所不同,而AFAIK包含整个文件系统目录。如果您希望将文件合并到项目中,则必须根据需要执行此操作或将其直接复制到解决方案资源管理器。当然,如果你想使用SVN,最好选择VS插件,它可以在不打扰你的情况下完成工作。 (即AnkhSVN - 开源和免费)。

You can also develop your own "watchdog" plugin to refresh the content ;)

您还可以开发自己的“看门狗”插件来刷新内容;)

Best regards, J.

最好的问候,J。

#2


VS2008, off-course can have directory structure for the project. But you need to manually create it. To do this, right-click on you project, and their you will find "add folder" menu. You can create the same folder set as followed by your project.

VS2008,off-course可以有项目的目录结构。但您需要手动创建它。要执行此操作,请右键单击您的项目,然后您将找到“添加文件夹”菜单。您可以创建项目所遵循的相同文件夹集。

Automatic file addition: I have not heard of this. Probably its not possible. Unless you are adding too many files to your project, adding files manually is not that difficult in VS ..

自动添加文件:我没有听说过这个。可能它不可能。除非您向项目添加太多文件,否则在VS中手动添加文件并不困难。