8

从 v3.9.43 通过 nuGet 升级到 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 帖子的建议并没有解决问题。

我注意到这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

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

4

1 回答 1

1

当 v4 发布时,程序集版本故意从 3.9.* 更改为 1.0.0.0。

这可能是由于v4 ServiceStack.Interfaces.dll 被更改为强名称和版本 4.0。'bsd' 3.9.* 版本已回滚到 1.0,可能显然是最旧的版本。

此 SO answer中注明了更多详细信息。

于 2014-03-10T15:50:43.607 回答