从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'
Run Code Online (Sandbox Code Playgroud)
所有其他ServiceStack dll都被复制,只缺少ServiceStack.Interfaces.所有引用都设置为Copy Local = True,并且此StackOverflow帖子的建议无法解决问题.
我注意到这ServiceStack.Interfaces.dll是唯一版本为1.0.0.0的版本,所有其他版本都设置为3.9.70.0.这可能是一个原因吗?
有没有人知道如何修复它而无需在引用我的类库的所有项目中手动引用ServiceStack.Interfaces.dll?
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>
Run Code Online (Sandbox Code Playgroud)
为此(注意到删除的排除)
<RegexTransform Include="$(BuildSolutionDir)/src/**/AssemblyInfo.cs">
<Find>\d+\.\d+\.\d+\.\d+</Find>
<ReplaceWith>$(Version)</ReplaceWith>
</RegexTransform>
Run Code Online (Sandbox Code Playgroud)
结果:现在它正常工作,即文件ServiceStack.Interfaces.dll被复制到引用引用项目的项目ServiceStack.
有人可以向我解释这个吗?为什么要将接口排除在版本之外?
v4 发布时,程序集版本有意从 3.9.* 更改为 1.0.0.0。
这可能是由于v4 ServiceStack.Interfaces.dll 被更改为强名称和版本 4.0。“bsd”3.9.* 版本已回滚到 1.0,这可能是最古老的版本。
在此 SO 答案中注明了更多详细信息。
| 归档时间: |
|
| 查看次数: |
1891 次 |
| 最近记录: |