【问题标题】:ServiceStack.Interfaces.dll no longer copied over to dependent projectsServiceStack.Interfaces.dll 不再复制到依赖项目
【发布时间】:2013-11-11 22:35:14
【问题描述】:

在通过 nuGet 从 v3.9.43 升级到 ServiceStack v3.9.70 后,我注意到 ServiceStack.Interfaces.dll 不再复制到依赖于使用 ServiceStack 的类库的项目中。这会导致以下错误:

System.IO.FileNotFoundException: Could not load file or assembly 'ServiceStack.Interfaces, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.
File name: 'ServiceStack.Interfaces, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'

所有其他 ServiceStack dll 都被复制,只有 ServiceStack.Interfaces 丢失。所有引用都设置为Copy Local = True,这个StackOverflow post的建议并没有解决问题。

我注意到ServiceStack.Interfaces.dll 是唯一一个版本为 1.0.0.0 的版本,所有其他版本都设置为 3.9.70.0。这可能是一个原因吗?

在所有引用我的类库的项目中,有谁知道如何在不手动引用 ServiceStack.Interfaces.dll 的情况下修复它?

更新 - 2014-03-06

v3.9.71.0 仍然存在问题。这确实与ServiceStack.Interfaces 程序集的版本保留为 1.0.0.0 而不是现在的事实有关。

我克隆了 ServiceStack 的 github 存储库,并在 build\build.proj 文件中更改了这一行并运行了 build\build.bat

<!-- Exclude versioning future strong-named libs -->
<RegexTransform Include="$(BuildSolutionDir)/src/**/AssemblyInfo.cs"
                Exclude="$(SrcDir)/ServiceStack.Interfaces*/Properties/AssemblyInfo.cs">
   <Find>\d+\.\d+\.\d+\.\d+</Find>
   <ReplaceWith>$(Version)</ReplaceWith>
</RegexTransform>

为此(注意到已删除的排除项)

<RegexTransform Include="$(BuildSolutionDir)/src/**/AssemblyInfo.cs">
   <Find>\d+\.\d+\.\d+\.\d+</Find>
   <ReplaceWith>$(Version)</ReplaceWith>
</RegexTransform>

结果:现在它可以正常工作了,即将文件ServiceStack.Interfaces.dll 复制到引用ServiceStack 的项目的项目中。

有人可以向我解释一下吗?为什么要从版本控制中排除接口?

【问题讨论】:

  • 这方面有没有成功?
  • 很遗憾,除了手动添加引用,没有。

标签: servicestack


【解决方案1】:

在 v4 发布时有意将程序集版本从 3.9.* 更改为 1.0.0.0。

这可能是由于v4 ServiceStack.Interfaces.dll being changed to being strong-named and versioned 4.0。 'bsd' 3.9.* 版本已回滚到 1.0,可能显然是最旧的版本。

更多细节在this SO answer中注明。

【讨论】:

  • 好的,谢谢。您知道如何在不将版本号更改回 3.9 的情况下解决 DLL 复制问题吗?
  • 可能还需要在 ServiceStack.Interaces 中添加对某些内容的引用;见:stackoverflow.com/q/26163368/210780
猜你喜欢
  • 1970-01-01
  • 2010-10-30
  • 1970-01-01
  • 2013-02-14
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2013-11-25
相关资源
最近更新 更多