Xamarin Studio和项目参考

时间:2022-03-17 06:38:03

So i try to develop little andriod application by Xamarin Studio 5.4. I have three projects in my solution - project of android application (ClientProject), some class library that used by first one (MyLib) and some console application (ConsoleApp).

所以我尝试通过Xamarin Studio 5.4开发小型andriod应用程序。我的解决方案中有三个项目 - android应用程序项目(ClientProject),第一个使用的类库(MyLib)和一些控制台应用程序(ConsoleApp)。

But when i try to add reference to MyLib into ClientProject i fail. Xamarin Studio tells me that "Incompatible target framework .NET Framework Version 4.0".

但是当我尝试将对MyLib的引用添加到ClientProject中时,我失败了。 Xamarin Studio告诉我“不兼容的目标框架.NET Framework 4.0”。

That looks this

看起来这个

Xamarin Studio和项目参考

I changed MyLib's framework version to 3.5, to 4.5 but it takes no effect.

我将MyLib的框架版本更改为3.5,但是它没有任何效果。

But when i try to add this reference into ConsoleApp there is no problem:

但是,当我尝试将此引用添加到ConsoleApp时,没有问题:

Xamarin Studio和项目参考

So i have to add to ClientProject a reference to MyLib.dll so I can not debug its code. What should i do to solve this problem?

所以我必须向ClientProject添加对MyLib.dll的引用,因此我无法调试其代码。我该怎么做才能解决这个问题?

1 个解决方案

#1


5  

The Android project will have a framework of MonoAndroid. This framework is incompatible with the full .NET Framework. Your options are to do one of the following:

Android项目将拥有MonoAndroid框架。此框架与完整的.NET Framework不兼容。您可以选择执行以下操作之一:

  1. Create an Android Library Project.
  2. 创建一个Android库项目。
  3. Create a Portable Class Library Project.
  4. 创建可移植类库项目。
  5. Create a Shared Project.
  6. 创建共享项目。

If you are only interested in creating an Android application, and not interested in using the library for other mobile platforms, then the first option will be the simplest.

如果您只对创建Android应用程序感兴趣,并且对将该库用于其他移动平台不感兴趣,那么第一个选项将是最简单的。

#1


5  

The Android project will have a framework of MonoAndroid. This framework is incompatible with the full .NET Framework. Your options are to do one of the following:

Android项目将拥有MonoAndroid框架。此框架与完整的.NET Framework不兼容。您可以选择执行以下操作之一:

  1. Create an Android Library Project.
  2. 创建一个Android库项目。
  3. Create a Portable Class Library Project.
  4. 创建可移植类库项目。
  5. Create a Shared Project.
  6. 创建共享项目。

If you are only interested in creating an Android application, and not interested in using the library for other mobile platforms, then the first option will be the simplest.

如果您只对创建Android应用程序感兴趣,并且对将该库用于其他移动平台不感兴趣,那么第一个选项将是最简单的。