简体   繁体   English

C#-编译器错误

[英]C# - Compiler error

I am making an app in C# using Mono and I am referencing two libraries which is giving me an error. 我正在使用Mono使用C#制作应用程序,并且我引用了两个库,这给了我一个错误。 How can I mae it so that i only reference one. 我怎么能做到这一点,所以我只引用一个。

this is the error i am getting 这是我得到的错误

Error 1 The type 'System.Drawing.RectangleF' exists in both 'c:\\Program Files (x86)\\Reference Assemblies\\Microsoft\\Framework\\MonoAndroid\\v2.3\\Mono.Android.dll' and 'c:\\Program Files (x86)\\Reference Assemblies\\Microsoft\\Framework\\MonoTouch\\v4.0\\monotouch.dll' C:\\Users\\cmtc\\documents\\visual studio 2012\\Projects\\BoostITAndroid\\BoostITAndroid\\HelperClasses\\RightAlignedEntryElement.cs 19 50 BoostITAndroid

how do I make it so I only select System.Drawing.RectangleF from one of the libraries 如何做到这一点,所以我只从其中一个库中选择System.Drawing.RectangleF

Use Alias referencing: 使用别名引用:

using Name1 = Android.Mono;
using Name2 = Monotouch;

Wherever you are using the reference, use the alias name that you wanted to use, for example; 例如,无论在何处使用引用,都应使用想要使用的别名。

Name1.RectangleF rectF = new Name1.RectangleF();

This way you keep both reference. 这样,您可以保留两个参考。

For me what solved was to remove an unwanted reference in the android project: Xamarin.iOS or check if you have Android.Mono on your iOS project. 对我来说,解决的办法是在android项目:Xamarin.iOS中删除不需要的引用,或检查iOS项目中是否有Android.Mono。 If you do have such reference, remove it, close visual studio and rebuild 如果您确实有这样的参考,请将其删除,关闭Visual Studio并重建

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM