多平台 MSBuild 项目文件

发布于 2024-11-06 15:27:39 字数 969 浏览 0 评论 0原文

我目前正在开发一个项目,该项目的源代码应该尽可能可移植;也就是说,该项目(用 C# 编写,但不是很相关)代表一个应在 Android(使用 Mono-Android)、iPhone(使用 MonoTouch)和 WinMobile(使用官方 Compact Framework)上执行的应用程序。无需详细说明,相应的 MSBuild 解决方案由一个独立平台的库(至少从源代码的角度来看)组成,它声明了各种接口和类,这些接口和类代表了各个平台不常见的每个功能的抽象(即用户界面)。此外,还有一个相应的库专门(针对每个平台)“基础库”;有效的应用程序可执行文件是使用抽象和通用标准库的程序。

在 WinMobile 和 Android 上进行开发实际上并不是问题:Mono-Android 插件可以安装在 VS 2010 上,因此 MS VS 可以处理这两个平台。

最初解决方案是在 VS 中创建的,因此初始配置和相关项目(Android 和 WinMobile)会自动生成。

之后,我在 Mac 下的 MonoDevelop(MonoTouch 官方支持的唯一平台)中导入了解决方案,并为 iPhone 库创建了项目;切换配置以生成程序集(iPhoneSimulator),由于缺少项目类型配置,无法编译“基础库”;具体来说,MonoTouch 用于 的 GUID 是 {E613F3A2-FE9C-494F-B74E-F63BCB86FEA6};添加此 GUID 我现在可以在 MonoDevelop 中编译“基础库”。

当我尝试在 VS 中重新导入解决方案时,出现了问题:由于没有 Windows 版本的 MonoTouch,VS 无法找到指定项目类型的加载项,并且项目无法加载。

查看MSBuild项目文件的规范,似乎有大量选项无法在VS的项目/解决方案编辑器中设置或修改;但是格式相当复杂,现在我请求您的帮助!

有没有办法在项目文件中指定仅当独立选择特定配置到我正在使用的环境时才存在项目类型?

I'm currently working on a project which source code should be as portable as possible; that is, the project (in C#, but it is not very relevant) represent an application that should be executed on Android (with Mono-Android), on iPhone (with MonoTouch) and WinMobile (with official Compact Framework). Without going into details, the corresponding MSBuild solution consists of an independent-platform library (from a source code point of view, at least) which declare various interfaces and classes that represent an abstraction of each feature that is not common to the various platform (i.e. the UI). In addition, there are a corresponding library that specialize (for each platform) the "base library"; the effective application executable is a program that uses the abstraction and the common standard libraries.

Developing on WinMobile and Android is not really a problem: Mono-Android add-in can be installed on VS 2010, so both platforms can be handled with MS VS.

Initially the solution was created in VS, so the initial configuration and the related projects (Android and WinMobile) are automatically generated.

After that I've imported the solution in MonoDevelop under Mac (the only platform that is officially supported by MonoTouch), and I've created the project for the iPhone library; switching the configuration to generate the assemblies (iPhoneSimulator) the "base library" was not possible to compile due to a missing project type configuration; specifically, the GUID used by MonoTouch for <ProjectTypeGuids> is {E613F3A2-FE9C-494F-B74E-F63BCB86FEA6}; adding this GUID I can now compile "base library" in MonoDevelop.

The problem arises when I try to re-import the solution in VS: since there's no Windows version of MonoTouch, VS cannot find the add-in for the specified project type, and the project doesn't load.

Looking to the specifications of MSBuild project file, it seems that there are tons of options that cannot be set or modified within the project/solution editor in VS; however the format is quite complicated and now I'm asking your help!

Is there a way to specify in the project file that a project type is present only if a particular configuration is selected independently to which is the environment I'm using?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

酒儿 2024-11-13 15:27:39

一般方法是这样的;逐步构建您的属性的条件,引用属性可能已经具有的任何值:

<ProjectTypeGuids
   Condition="'$(BuildingInsideVisualStudio)' != 'true'"
   >;{E613F3A2-FE9C-494F-B74E-F63BCB86FEA6}"</ProjectTypeGuids>
<ProjectTypeGuids>{OTHER-GUIDS-HERE}$(ProjectTypeGuids)</ProjectTypeGuids>

这将检测 VS 条件(构建时)并忽略未知的 guid。但我不确定项目开放时它是否会起作用,该属性可能仅适用于建筑。在 Mono 上构建可能有类似的“sentinal”属性,您可以反转条件。

The general approach is something like this; a condition that progressivly builds your property, referencing any value the property already may have:

<ProjectTypeGuids
   Condition="'$(BuildingInsideVisualStudio)' != 'true'"
   >;{E613F3A2-FE9C-494F-B74E-F63BCB86FEA6}"</ProjectTypeGuids>
<ProjectTypeGuids>{OTHER-GUIDS-HERE}$(ProjectTypeGuids)</ProjectTypeGuids>

This will detect the VS condition (when building) and omit the unkonwn guid. I'm not sure however if it will work when the project is opened, this property might only apply to building. There may be a similar "sentinal" property for building on Mono, and you can reverse the condition.

一个人练习一个人 2024-11-13 15:27:39

我解决了一个不相关但非常相似的跨平台开发问题,方法是排除在 Linux 和 Windows 之间切换时表现出古怪的文件。我将我的项目置于源代码控制之下,并利用它来保持工作的协作性。
http://www.aydabtudev.com/2011 /05/what-goes-into-source-control-android.html

这不是您的问题的一对一,但它可能会为您提供有关如何解决问题的线索/想法。

I solved an unrelated, but very similar issue of cross-platform development by excluding the files that presented themselves as cranky when going between Linux and Windows. I have my project under source control and utilized that to keep things working cooperatively.
http://www.aydabtudev.com/2011/05/what-goes-into-source-control-android.html

It's not a 1-to-1 for your issue, but it might give you clues/ideas on how to solve your problem.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文