ServiceStack.Interfaces.dll不再复制到依赖项目

时间:2013-11-11 22:35:15

标签: servicestack

从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 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的项目的项目。

有人可以向我解释这个吗?为什么要将接口排除在版本之外?

1 个答案:

答案 0 :(得分: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中提到的更多细节。

相关问题