MonoTouch项目中的问题加载程序集 [英] Problem loading Assemblies in MonoTouch Project

查看:51
本文介绍了MonoTouch项目中的问题加载程序集的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在构建Monotouch(试用版)4.0.3.项目.它会显示警告:

I am building a Monotouch (trial) 4.0.3. project. It compiles with the warning:

警告:应用程序捆绑包中缺少库'loader.dll',无法提取内容

Warning: Library 'loader.dll' missing in app bundle, cannot extract content

所有其他dll在构建过程中均已成功捆绑,而该dll之前曾在使用.编译警告后,如果无法加载程序集,则在运行时(在模拟器上)加载时会崩溃,并出现分段错误.

All of the other dlls are successfully bundled during build, and this one was working before. After compiling with the warning, it crashes on load at runtime (on the simulator) with a segmentation fault when it fails to load the assembly.

我已经搜索了此警告,但找不到任何对此的引用. 有谁知道为什么不将程序集添加到应用程序包中?

I have searched for this warning and I haven't been able to find any references to it. Does anyone know why the assembly is not being added to the app package?

推荐答案

mhutch是正确的,链接程序正在机会性地删除该库.但是,默认的链接器设置是不链接任何内容,因此,他的解决方案仅在链接所有程序集的极少数情况下才有效(您不希望与MonoTouch一起使用,因为绝不应该嵌入对SDK的引用)

mhutch is correct, the linker is opportunistically pruning out the library. However, the default linker setting is not to link anything, so his solution will only work in the rare case that you're linking all assemblies (which you don't want to do with MonoTouch because references to the SDK should never be embedded).

解决方法是从调用程序集内部新建要使用的库中某个实例.

The workaround is to just new up an instance of something in the library you want to use, from inside the calling assembly.

using MonoTouch.Foundation;
using MonoTouch.UIKit;
using MyLibrary;

namespace MyApp
{
    public class Application
    {
        static void Main(string [] args)
        {
            new MyLibrary.DontPruneMeBro();

            UIApplication.Main(args, null, "AppDelegate");
        }
    }
}

顺便说一句,我不知道iOS开发人员会做什么,因为这种行为会使运行时无法访问卫星库.

As an aside, I don't know what iOS developers do, since this behavior would make run-time access to satellite libraries impossible.

这篇关于MonoTouch项目中的问题加载程序集的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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