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

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

问题描述

我有一个空的 Class library 项目并想安装以下 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'.

其他 nugets,例如Entity FrameworkMicrosoft.TeamFoundation.Client 我能够安装.

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

我的配置

  • Windows 7 企业版
  • Visual Studio 企业版 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 的Contact Owner"功能尝试通知 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. 在我的项目中添加对解压包中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 文件中.

Add the line <package id="nuget-bot.Microsoft.TeamFoundation.WorkItemTracking.Client.DataStoreLoader" version="12.0.31101" targetFramework="net452" /> to the packages.config file for my project.

这会导致 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天全站免登陆