使用相同的源代码在不同平台上进行多个构建 [英] Multiple Builds for different platforms using the same source code

查看:175
本文介绍了使用相同的源代码在不同平台上进行多个构建的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Visual Studio2008.我正在为一个软件(.dll)写一个插件.使用外接程序的人员可以在不同的平台上工作(该软件的x86和x64位版本不同).在所有这些平台上,我的插件的源代码都是相同的,但其附加的引用将有所不同.我想做的是一次生成所有不同的dll.现在,我认为可以用所有对应的引用创建多个项目并将它们包含在同一个解决方案中,我不知道如何在不同的项目之间共享相同的源以使它们一次被编译……有人吗?有做这种事情的经验吗?

解决方案

如果要在项目之间共享相同的代码,则在添加通用源文件时必须选择添加为链接". /blockquote>

创建(空白)项目后,只需右键单击源文件夹,选择添加现有项",导航到公共源文件,然后按OK.现在,源文件已链接到您的项目,可以使用项目特定的设置进行构建.您还可以在项目设置中使用#if #endif块和预处理器定义包括或排除源的特定部分.


I am using visual studio 2008. I am writting an addin for a piece of software (.dll). The people using the addin works in different platforms (different versions of this software in either x86 and x64 bits). The source code of my addin will be the same across all these platforms but the references attached to it will be different. What I would like to do is to build all different dll''s in one shot. Now, I theorize that I can create multiple projects with all the correspondent references and include them within the same solution, what I dont know is how to share the same source between the different projects to make them compile at once... Does anyone have any experience doing this kind of thing? Any help would be appreciated.

解决方案

You have to choose "Add as link" when adding the common source files if you want to share the same code between projects.


Once you have created your (blank) projects, just right click on the source folder, select "Add existing item", navigate to your common source file and press OK. The source file is now linked to your project ready to be built with project specific settings. You can also include or exclude specific portions of the source with #if #endif blocks and preprocessor definitions in the project settings.


这篇关于使用相同的源代码在不同平台上进行多个构建的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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