如何解决无法添加对“ Microsoft.WITDataStore”的引用? [英] How to solve Failed to add reference to 'Microsoft.WITDataStore'?

查看:133
本文介绍了如何解决无法添加对“ Microsoft.WITDataStore”的引用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个空的 Class库项目,并想安装以下NuGet作为依赖项:

I got empty Class library project and want to install following NuGet as dependency:

nuget-bot.Microsoft.TeamFoundation.WorkItemTracking.Client.DataStoreLoader.12.0.31101

安装失败并显示错误:


无法添加对 Microsoft.WITDataStore的引用。

Failed to add reference to 'Microsoft.WITDataStore'.

其他小坚果,例如实体框架 Microsoft.TeamFoundation.Client 我能够安装。

Other nugets, e.g. Entity Framework or Microsoft.TeamFoundation.Client I was able to install.

我的配置


  • Windows 7 Enterprise

  • Visual Studio Enterprise 2015

  • 用于Visual Studio 2015的NuGet软件包管理器

谢谢。

推荐答案

这似乎是 NuGet程序包

Microsoft.WITDataStore.dll 是一个非托管库,不能由.NET项目直接引用。为什么程序包安装失败。

Microsoft.WITDataStore.dll is an unmanaged library that cannot be directly referenced by a .NET project, which is why the package installation fails.

Microsoft.TeamFoundation.WorkItemTrackingClient.DataStoreLoader.dll 是一个.NET包装库允许访问 Microsoft.WITDataStore.dll 中的非托管代码。 应该正在发生的事情是,程序包应该添加.NET库( DataStoreLoader.dll )作为程序集引用,并添加非托管库( WITDataStore.dll )作为内容项,配置为在构建时复制到 bin\ 目录中。相反,它试图将它们都添加为程序集引用,但失败并被NuGet回滚。

The Microsoft.TeamFoundation.WorkItemTrackingClient.DataStoreLoader.dll is a .NET wrapper library allowing access to the unmanaged code in Microsoft.WITDataStore.dll. What should be happening is that the package should add the .NET library (DataStoreLoader.dll) as an assembly reference and add the unmanaged library (WITDataStore.dll) as a content-item configured to be copied into the bin\ directory on build. Instead, it's attempting to add them both as assembly references, which fails and is rolled back by NuGet.

我已经使用NuGet的联系人所有者功能来尝试通知Microsoft的发行商指出了该软件包的配置错误,但是由于该软件包是由 nuget-bot发布的,因此,我不知道这样做是否有帮助。如果已更新软件包以解决此问题,我将更新此答案。
我当前正在使用的解决方法是:

I've used NuGet's "Contact Owner" feature to attempt to notify the publisher at Microsoft of the package's misconfiguration, but since it's been published by "nuget-bot", I don't know if that will accomplish anything. I'll update this answer if the package is updated to resolve the issue. The workaround I'm currently using is to:


  1. 手动下载该程序包,将其解压缩,然后将解压缩的文件夹复制到解决方案的 packages\ 目录中。

  2. 在我的项目中为<$ c $的副本添加引用c>压缩包中的Microsoft.TeamFoundation.WorkItemTrackingClient.DataStoreLoader.dll 。

  3. 添加文件 WITDataStore.dll 作为我项目的现有文件,并将其标记为属性下的始终复制。 (复制,如果更新,也可以使用)

  1. manually download the package, unzip it, and copy the unzipped folder into my solution's packages\ directory.
  2. Add a reference in my project to the copy of Microsoft.TeamFoundation.WorkItemTrackingClient.DataStoreLoader.dll in the unzipped package.
  3. Add the file WITDataStore.dll as an Existing File to my project, and mark it as "Copy Always" under "Properties". ("Copy if newer" will also work just fine)

添加行< package id = nuget-bot.Microsoft .TeamFoundation.WorkItemTracking.Client.DataStoreLoader version = 12.0.31101 targetFramework = net452 /> packages.config 文件

这会导致NuGet记录正在安装的软件包, DataStoreLoader.dll 被引用,而 WITDataStore.dll 被复制到您的 bin\ 每次构建时都包含文件夹,以便包装器库可以使用它。

This results in NuGet having a record of the package being installed, the DataStoreLoader.dll being referenced, and the WITDataStore.dll being copied into your bin\ folder whenever you build, so it can be used by wrapper library.

这篇关于如何解决无法添加对“ Microsoft.WITDataStore”的引用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆