[英]How to link third party dll from class library in Xamarin.iOS when using VS2012 and Build Host
I making a small cross platform project, and wan't my webservice calls, in a separate class library project. 我在一个单独的类库项目中进行了一个小型跨平台项目,并且不想进行Webservice调用。 I've created a Xamarin.iOS solution, and added a class library, which is referenced from the application.
我已经创建了Xamarin.iOS解决方案,并添加了一个类库,该类库已从应用程序中引用。 In the class library, I've defined a simple webservice class that calls a webservice and deserializes the json into a POCO using Newtonsoft.Json.
在类库中,我定义了一个简单的Web服务类,该类调用Web服务,并使用Newtonsoft.Json将json反序列化为POCO。 The problem is that because Newtonsoft.Json is referenced from the class library and not the application, the Newtonsoft.Json.dll file is not linked into the application - only the class library dll - and I get a file-not-found when deserializing.
问题是,因为从类库而不是应用程序中引用了Newtonsoft.Json,所以Newtonsoft.Json.dll文件未链接到应用程序中-仅链接到类库dll中,反序列化时得到的文件未找到。 I tried to use --linkskip=Newtonsoft.Json in the application but that doesn't help.
我试图在应用程序中使用--linkskip = Newtonsoft.Json,但这无济于事。
How do I force the buildhost to link that dll into the application? 如何强制buildhost将dll链接到应用程序?
I finally found a solution. 我终于找到了解决方案。 Since the linker don't care to embed the newtonsoft.json.dll in the solution, I add the file to the class library, besides referencing the one in the Component folder.
由于链接器不在乎将newtonsoft.json.dll嵌入解决方案中,因此除了引用Component文件夹中的文件外,我还将文件添加到类库中。 That seems to work.
这似乎有效。 No more "missing file"
不再有“丢失文件”
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.