How to solve Failed to add reference to #39;Microsoft.WITDataStore#39;?(如何解决无法添加对“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 Framework
或 Microsoft.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:
- 手动下载包,解压,然后将解压后的文件夹复制到我的解决方案的
packages
目录中. - 在我的项目中添加对解压包中
Microsoft.TeamFoundation.WorkItemTrackingClient.DataStoreLoader.dll
副本的引用. 将文件
WITDataStore.dll
作为现有文件添加到我的项目中,并在属性"下将其标记为始终复制".(如果较新则复制"也可以正常工作)
- manually download the package, unzip it, and copy the unzipped folder into my solution's
packages
directory. - Add a reference in my project to the copy of
Microsoft.TeamFoundation.WorkItemTrackingClient.DataStoreLoader.dll
in the unzipped package. 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"的引用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:如何解决无法添加对“Microsoft.WITDataStore"的引用?
基础教程推荐
- rabbitmq 的 REST API 2022-01-01
- 将 Office 安装到 Windows 容器 (servercore:ltsc2019) 失败,错误代码为 17002 2022-01-01
- SSE 浮点算术是否可重现? 2022-01-01
- 将 XML 转换为通用列表 2022-01-01
- 如何在 IDE 中获取 Xamarin Studio C# 输出? 2022-01-01
- c# Math.Sqrt 实现 2022-01-01
- 为什么Flurl.Http DownloadFileAsync/Http客户端GetAsync需要 2022-09-30
- MS Visual Studio .NET 的替代品 2022-01-01
- 如何激活MC67中的红灯 2022-01-01
- 有没有办法忽略 2GB 文件上传的 maxRequestLength 限制? 2022-01-01