【问题标题】:Adding NuGet ndef library to windows phone 8 project将 NuGet ndef 库添加到 windows phone 8 项目
【发布时间】:2012-10-31 19:30:21
【问题描述】:
所以我尝试在 Visual Studio 2012 中为 Windows Phone 8 应用程序添加邻近应用程序的 NDEF 库。在Package Manager 中,我检查了Allow NuGet to download missing packages during build,在Solution Explorer 中,我选择了Enable NuGet Package Restore。
到目前为止一切顺利,但是当我尝试安装软件包时出现以下错误:
无法安装包“NdefLibrary 0.9.0.1”。您正在尝试将此包安装到以“WindowsPhone,Version=v8.0”为目标的项目中,但该包不包含与该框架兼容的任何程序集引用。如需更多信息,请联系包作者。
【问题讨论】:
标签:
visual-studio-2012
nuget
nfc
windows-phone-8
ndef
【解决方案1】:
这在我的开发盒上运行良好。这是我的 NuGet 包管理器在 WP8 项目中的输出:
PM> Install-Package NdefLibrary
You are downloading NdefLibrary from Andreas Jakl, the license agreement to which is available at https://ndef.codeplex.com/license. Check the package for additional dependencies, which may come with their own license agreement(s). Your use of the package and dependencies constitutes your acceptance of their license agreements. If you do not accept the license agreement(s), then delete the relevant components from your device.
Successfully installed 'NdefLibrary 0.9.0.1'.
Successfully added 'NdefLibrary 0.9.0.1' to Wp8TestApp.
您可能缺少的是将 NuGet 包管理器更新到最新版本。转到 Visual Studio 文件菜单 --> 工具 --> 扩展和更新 --> 更新 --> Visual Studio 库 --> NuGet --> 更新,最后您需要重新启动。需要此更新的原因是 VS2012 RTM 附带的 NuGet 版本不支持 WP8,因为 WP8 在 VS2012 之前没有 RTM。