简体   繁体   English

使用VS2012和Build Host时如何从Xamarin.iOS中的类库链接第三方dll

[英]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.

相关问题 Xamarin.iOS与第三方框架的绑定 - Xamarin.iOS binding with third party framework VS2012调试器只能观看一次来自第三方引用的变量 - VS2012 Debugger can watch variables from third party reference only once 使用 MSAL 从 Xamarin.ios 授权时出现 SecurityTokenInvalidSignatureException - SecurityTokenInvalidSignatureException when authorizing from Xamarin.ios using MSAL VS2012没有显示DLL参考中的某些功能 - VS2012 does not show some functions from DLL reference C#VS2012参考,添加了类库? - C# VS2012 references, adding a Class Library? Nunit没有在测试项目类库(VS2012)中遇到断点 - Nunit not hitting breakpoints in test project class library (VS2012) 从第三方应用程序调用类库时缺少MissingMethodException - MissingMethodException when calling to a class library from third-party application 如何在VS2012中将dll更改为发布模式? - How to change dll into release mode in VS2012? 如何在Xamarin.iOS中实现+(Class)layerClass? - How to implement +(Class) layerClass in Xamarin.iOS? 如何在C#类库项目(VS2012)中嵌入和使用.txt文件作为资源? - How can I embed and use a .txt file as resource in a C# Class Library Project (VS2012)?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM