[英]How do I build two different apps from one Visual C# project?
I have a source base that, depending on defined flags at build time, creates two different apps.我有一个源代码库,它根据构建时定义的标志创建两个不同的应用程序。 I can build both of these apps using a Makefile by specifying two different targets, one that compiles with a flag and one that compiles without, and having an aggregate target that builds both.
我可以使用 Makefile 通过指定两个不同的目标来构建这两个应用程序,一个使用标志进行编译,一个不使用标志进行编译,并且具有一个可以同时构建两者的聚合目标。
How do I do the equivalent thing from Visual C# Express on Windows?如何在 Windows 上从 Visual C# Express 执行等效操作?
Create one solution with two project files in the same folder.使用同一文件夹中的两个项目文件创建一个解决方案。 Set two different configurations in your solution, one of them building one of the projects, the other one building the other project.
在您的解决方案中设置两种不同的配置,其中一个构建一个项目,另一个构建另一个项目。
Alternatively, you can have one project which always builds to intermediate binary and then have a postbuild step that copies it to the final binary depending on the flag.或者,您可以拥有一个始终构建为中间二进制文件的项目,然后进行构建后步骤,根据标志将其复制到最终二进制文件。
Release vs Debug?发布与调试? You can create your own custom configurations as well.
您也可以创建自己的自定义配置。 But building a completely different app based on the configuration seems like a bad idea.
但是基于配置构建一个完全不同的应用程序似乎是一个坏主意。
Normal visual studio can have multiple projects in one solution, and I think there's a way to shoe-horn this into Express edition (perhaps by opening a solution created elsewhere).普通的 Visual Studio 可以在一个解决方案中包含多个项目,我认为有一种方法可以将其硬塞到 Express 版本中(也许通过打开在别处创建的解决方案)。
Really,though, you may have to settle for keeping two instances of Visual Studio open at at a time.不过,实际上,您可能不得不满足于同时打开两个 Visual Studio 实例。 You can always set one of them to build right into the /bin/Release/ folder of the other project if you want.
如果需要,您始终可以将其中一个设置为直接构建到另一个项目的 /bin/Release/ 文件夹中。
I don't know exactly about Express versions, but in Visual Studio there is a menu item Build->Batch Build
to build all configurations at once.我不完全了解 Express 版本,但在 Visual Studio 中有一个菜单项
Build->Batch Build
可以一次构建所有配置。
I don't find visual studio easy to work with when I have complex build output scenario's.当我有复杂的构建输出场景时,我不觉得 Visual Studio 很容易使用。 What I typically do in these situations is use NAnt with a continuous integration tool like CruiseControl.Net .
在这些情况下,我通常做的是将NAnt与像CruiseControl.Net这样的持续集成工具一起使用。 You can also build the project outputs locally with the same NAnt script.
您还可以使用相同的 NAnt 脚本在本地构建项目输出。
A NAnt script is essentially an Xml build file with heaps more functionality. NAnt 脚本本质上是一个 Xml 构建文件,具有更多功能。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.