【发布时间】:2018-06-04 06:16:00
【问题描述】:
我正在尝试为我的库创建一个依赖于 Unity 的 nuget 包。为此,我在我的 nuspec 文件中放置了以下行。
<dependencies>
<dependency id="Unity" version="[3.5.0.0]" include="all" />
</dependencies>
然后在命令下面执行
nuget pack MyClient.MyProject.ApplicationData.csproj -Prop Configuration=Release
当我使用生成的包时,在运行时我收到错误消息,“无法加载文件或程序集 'Microsoft.Practices.Unity, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' 或其之一依赖项。找到的程序集的清单定义与程序集引用不匹配。(HRESULT 异常:0x80131040)"
This question 似乎指向类似的问题,指的是我按照其引用的链接中的建议复制了 nuget.config 文件,但这没有帮助。 nuget.config文件内容如下:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<config>
<add key="repositoryPath" value="packages" />
</config>
<solution>
<add key="disableSourceControlIntegration" value="true" />
</solution>
</configuration>
我的项目层次结构是这样的
MyClient
--MyProject
----MyProj.csproj
----MyProj.nupkg
--Packages
----Unity.3.5.1404.0
--NuGet.Config
我得到了最新版本的 nuget,这是我第一次创建 nuget 包,有人可以建议我在这里可能缺少什么。有什么指点吗?
谢谢,
拉维
【问题讨论】:
标签: nuget nuget-package