简体   繁体   English

Unity 在 Visual Studio 中找不到与 Nuget 一起安装的 package

[英]Unity can't find package installed with Nuget in Visual Studio

I installed some ASP.NET packages ( FirebaseStorage.net if it matters) via Nuget in my game's project in Visual Studio.我在 Visual Studio 的游戏项目中通过 Nuget 安装了一些 ASP.NET 包(如果重要,则为FirebaseStorage.net )。

Visual Studio itself shows no errors, as it probably understands using Firebase.Storage internally, but when it comes to Unity, it says Visual Studio 本身没有显示任何错误,因为它可能理解在内部using Firebase.Storage ,但是当涉及到 Unity 时,它说

The type or namespace name 'Firebase' could not be found (are you missing a using directive or an assembly reference?)找不到类型或命名空间名称“Firebase”(您是否缺少 using 指令或程序集引用?)

I believe this happens because I installed this package through the Nuget Package Manager, inside Visual Studio, and it probably has nothing to do with Unity, so Unity doesn't find it.我相信这是因为我在 Visual Studio 中通过 Nuget Package 管理器安装了这个 package,它可能与 Unity 无关,所以 Unity 找不到它。

How can I make Unity understand packages from Nuget?如何让 Unity 理解来自 Nuget 的包?

If you want to use a Nuget package in Unity you have to add it manually.如果你想在 Unity 中使用 Nuget package,你必须手动添加它。

How you can do this:如何做到这一点:

  • create a separate temporary Visual Studio project创建一个单独的临时 Visual Studio 项目

  • install the Nuget package安装 Nuget package

  • copy the dll's from the temporary project to a "plugins" folder in the Assets folder of Unity.将临时项目中的 dll 复制到 Unity 的 Assets 文件夹中的“plugins”文件夹中。

  • Unity now builds the project with the dll's of the Nuget package Unity 现在使用 Nuget package 的 dll 构建项目

  • However, now comes the hard part of having to do it manually: if the dll has dependencies on other dll's, these will also have to be added manually.然而,现在遇到了必须手动完成的困难部分:如果 dll 依赖于其他 dll,这些也必须手动添加。 That is the big advantage of Nuget package manager.这就是 Nuget package 管理器的一大优势。

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

相关问题 在Visual Studio Code for Unity中安装Nuget程序包 - Install a Nuget package in Visual Studio Code for Unity 为什么 Visual Studio 找不到这个 nuget 包的 .props 文件? - Why can't Visual Studio find this nuget package's .props file? 无法访问已安装的 Nuget 包 - Can't access installed Nuget Package 无法在 Visual Studio 中导入已安装的 package c# - can't import an installed package c# in visual studio 如何在Visual Studio中运行作为NuGet软件包安装的wkhtmltopdf(.exe) - How run wkhtmltopdf(.exe) installed as NuGet package in Visual Studio Visual Studio编译错误-计算机中缺少nuget软件包,但是nuget restore表示已安装所有软件包? - Visual Studio compile error - nuget package missing from computer, but nuget restore says all packages installed? 在Nuget中找不到软件包(Pechkin) - Can't Find Package (Pechkin) in Nuget Visual Studio 2017 Xamarin无法安装nuget包MvvmCross.Plugin.DownloadCache插件 - Visual Studio 2017 Xamarin can't install nuget package MvvmCross.Plugin.DownloadCache plugin 为什么我无法使用 Nuget 包管理在 visual studio 中将 Xamarin.forms 升级到更高版本 - Why I can't upgrade Xamarin.forms to higher version in visual studio with Nuget Package manage Nuget 包未在 Visual Studio 中更新 - Nuget package not updating in Visual Studio
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM