本文介绍了使用 nuget 添加时,为什么在我的 Xamarin.Android 项目中没有选择 TinyIoC?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以我在我的 Xamarin.Android 项目中使用 nuget 安装了 TinyIoC v1.3.0,它在参考文献中,但我无法在没有编译错误的情况下输入 using TinyIoC;.我想了解这是为什么?

附注.我知道我可以直接使用 TinyIoC.cs 文件,但我认为如果我使用 nuget 添加更新会更方便.

我收到此错误:

解决方案

我认为问题与 nuget 包

注意:重要

nuget 包包含一个名为 Content 的文件夹.此文件夹将使用

但是,由于您的项目是 xamarin andorid 应用程序,它使用 PackageReference nuget 管理格式,并且 content 文件夹不适用于它.相反,您应该使用 ContentFiles 文件夹,但此 nuget 包不包含它.

为了更清楚地说明这个问题,你应该联系nuget包的作者报告这个问题.

So I installed TinyIoC v1.3.0 using nuget in my Xamarin.Android project, its in the references, but I cannot type using TinyIoC; without a compile error. I would like to understand why this is?

PS. I know I can use the TinyIoC.cs file directly, but I thought it would be more convenient to update if I added using nuget.

I get this error:

解决方案

I think the issue is related to the nuget package TinyIoC 1.3.0 itself.

The nuget package does not contain the lib folder with the related dll so that you can not use the format by using namespace.

Note: Important

The nuget package contains a folder called Content. This folder will copy its content into the main project with packages.config when you install the nuget pacakge. See this similar issue on so.

And it will make TinyloC.cs file directly in your main project and you can just modify it there.

I have created a net framework project with packages.config format.

However, since your project is xamarin andorid app, it uses PackageReference nuget manage format, and content folder does not work for it. Instead, you should use ContentFiles folder, but this nuget package does not contain it.

To make this issue more clearly, you should contact the author of the nuget package to report this problem.

这篇关于使用 nuget 添加时,为什么在我的 Xamarin.Android 项目中没有选择 TinyIoC?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-02 14:31