我已经在Windows Sercice举办了ASP.NET的核心应用,所以它是一个.NETCore项目,但TargetFramework
是.NET框架。 这个微软文档描述了此类项目。
该应用程序正常工作与SerciceStack.Core 1.0.44,在这里不用我的项目文件的片段。
<PackageReference Include="ServiceStack.Core" Version="1.0.44" />
<PackageReference Include="ServiceStack.Kestrel" Version="1.0.44" />
<PackageReference Include="ServiceStack.Text.Core" Version="1.0.44" />
<PackageReference Include="ServiceStack.Api.Swagger.Core" Version="1.0.44" />
我现在想升级到5.0.2版本,后来我发现有组件的两个家庭。 ServiceStack 5.0.2和ServiceStack.Core 5.0.2
然后我试图以目ServiceStack.Core 5.0.2方向,发现它完全是一个烂摊子。
首先 ,没有ServiceStack.Api.Swagger.Core 5.0.2中,只有一个是ServiceStack.Api.Swagger 5.0.2 ,它是根据ServiceStack 5.0.2 。
其次 , ServiceStack.Kestrel 5.0.2依赖是在不同的家庭ServiceStack.Kestrel 1.0.44 。 您可以通过打开的链接比较依赖。
- ServiceStack.Kestrel 1.0.44取决于ServiceStack.Core 1.0.44 ;
- ServiceStack.Kestrel 5.0.2取决于ServiceStack 5.0.2
所以ServiceStack.Kestrel 5.0.2无法使用ServiceStack.Core 5.0.2了。
然后我尝试另一个方向ServiceStack 5.0.2 -改变到一个所有与没有核心后缀和遇到的另一个问题。
我应该在我的情况下,往哪个方向走?
最好的祝福
请阅读在.NET Framework上运行ASP.NET应用程序的核心文档。 你必须继续引用.Core
包,因为它们只包含.NET标准2.0版本。 引用无主包.Core
后缀如ServiceStack
在.NET Framework项目将引用net45建立它只能运行经典ASP.NET Framework或HttpListener应用。
在.NET核心应用应主要参考的NuGet包如ServiceStack
,因为它会忽略net45建立并仅供参考.NET标准2.0版本。
Finnally我得到的现有项目,第5版的工作。
首先,升级版5如下。
<PackageReference Include="ServiceStack.Api.Swagger" Version="5.0.2" />
<PackageReference Include="ServiceStack.Client.Core" Version="5.0.2" />
<PackageReference Include="ServiceStack.Common.Core" Version="5.0.2" />
<PackageReference Include="ServiceStack.Core" Version="5.0.2" />
<PackageReference Include="ServiceStack.Interfaces.Core" Version="5.0.2" />
<PackageReference Include="ServiceStack.Kestrel" Version="5.0.2" />
<PackageReference Include="ServiceStack.Text.Core" Version="5.0.2" />
然后有很多编译错误的下面。
error CS0433: The type 'IRequest' exists in both 'ServiceStack.Interfaces, Version=5.0.0.0, Culture=neutral, PublicKeyToken=null' and 'ServiceStack.Interfaces, Version=5.0.0.0, Culture=neutral, PublicKeyToken=02c12cbda47e6587'
error CS0433: The type 'IRequest' exists in both 'ServiceStack.Interfaces, Version=5.0.0.0, Culture=neutral, PublicKeyToken=null' and 'ServiceStack.Interfaces, Version=5.0.0.0, Culture=neutral, PublicKeyToken=02c12cbda47e6587'
error CS0433: The type 'IReturn<T>' exists in both 'ServiceStack.Interfaces, Version=5.0.0.0, Culture=neutral, PublicKeyToken=null' and 'ServiceStack.Interfaces, Version=5.0.0.0, Culture=neutral, PublicKeyToken=02c12cbda47e6587'
error CS0433: The type 'Service' exists in both 'ServiceStack, Version=5.0.0.0, Culture=neutral, PublicKeyToken=null' and 'ServiceStack, Version=5.0.0.0, Culture=neutral, PublicKeyToken=02c12cbda47e6587'
error CS0433: The type 'RouteAttribute' exists in both 'ServiceStack.Interfaces, Version=5.0.0.0, Culture=neutral, PublicKeyToken=null' and 'ServiceStack.Interfaces, Version=5.0.0.0, Culture=neutral, PublicKeyToken=02c12cbda47e6587'
error CS0246: The type or namespace name 'Verbs' could not be found (are you missing a using directive or an assembly reference?)
error CS0246: The type or namespace name 'Summary' could not be found (are you missing a using directive or an assembly reference?)
error CS0246: The type or namespace name 'Notes' could not be found (are you missing a using directive or an assembly reference?)
error CS0433: The type 'ApiMemberAttribute' exists in both 'ServiceStack.Interfaces, Version=5.0.0.0, Culture=neutral, PublicKeyToken=null' and 'ServiceStack.Interfaces, Version=5.0.0.0, Culture=neutral, PublicKeyToken=02c12cbda47e6587'
error CS0246: The type or namespace name 'Name' could not be found (are you missing a using directive or an assembly reference?)
error CS0246: The type or namespace name 'ParameterType' could not be found (are you missing a using directive or an assembly reference?)
error CS0246: The type or namespace name 'DataType' could not be found (are you missing a using directive or an assembly reference?)
error CS0246: The type or namespace name 'IsRequired' could not be found (are you missing a using directive or an assembly reference?)
error CS0246: The type or namespace name 'Description' could not be found (are you missing a using directive or an assembly reference?)
error CS0433: The type 'IReturn<T>' exists in both 'ServiceStack.Interfaces, Version=5.0.0.0, Culture=neutral, PublicKeyToken=null' and 'ServiceStack.Interfaces, Version=5.0.0.0, Culture=neutral, PublicKeyToken=02c12cbda47e6587'
error CS0433: The type 'ApiMemberAttribute' exists in both 'ServiceStack.Interfaces, Version=5.0.0.0, Culture=neutral, PublicKeyToken=null' and 'ServiceStack.Interfaces, Version=5.0.0.0, Culture=neutral, PublicKeyToken=02c12cbda47e6587'
error CS0246: The type or namespace name 'Name' could not be found (are you missing a using directive or an assembly reference?)
warning MSB3243: No way to resolve conflict between "ServiceStack, Version=5.0.0.0, Culture=neutral, PublicKeyToken=null" and "ServiceStack, Version=5.0.0.0, Culture=neutral, PublicKeyToken=02c12cbda47e6587". Choosing "ServiceStack, Version=5.0.0.0, Culture=neutral, PublicKeyToken=null" arbitrarily.
warning MSB3243: No way to resolve conflict between "ServiceStack.Client, Version=5.0.0.0, Culture=neutral, PublicKeyToken=null" and "ServiceStack.Client, Version=5.0.0.0, Culture=neutral, PublicKeyToken=02c12cbda47e6587". Choosing "ServiceStack.Client, Version=5.0.0.0, Culture=neutral, PublicKeyToken=null" arbitrarily.
warning MSB3243: No way to resolve conflict between "ServiceStack.Common, Version=5.0.0.0, Culture=neutral, PublicKeyToken=null" and "ServiceStack.Common, Version=5.0.0.0, Culture=neutral, PublicKeyToken=02c12cbda47e6587". Choosing "ServiceStack.Common, Version=5.0.0.0, Culture=neutral, PublicKeyToken=null" arbitrarily.
warning MSB3243: No way to resolve conflict between "ServiceStack.Interfaces, Version=5.0.0.0, Culture=neutral, PublicKeyToken=null" and "ServiceStack.Interfaces, Version=5.0.0.0, Culture=neutral, PublicKeyToken=02c12cbda47e6587". Choosing "ServiceStack.Interfaces, Version=5.0.0.0, Culture=neutral, PublicKeyToken=null" arbitrarily.
warning MSB3243: No way to resolve conflict between "ServiceStack.Text, Version=5.0.0.0, Culture=neutral, PublicKeyToken=null" and "ServiceStack.Text, Version=5.0.0.0, Culture=neutral, PublicKeyToken=02c12cbda47e6587". Choosing "ServiceStack.Text, Version=5.0.0.0, Culture=neutral, PublicKeyToken=null" arbitrarily.
这些错误是由引起ServiceStack.Api.Swagger
和ServiceStack.Kestrel
。 在以前的版本中,它们依赖于ServiceStack.Core
其publicKeyToken
为空; 但在这个新版本中,它们依赖于ServiceStack
其publicKeyToken
存在。
在这种情况下绑定重定向不能帮助,因为publicKeyToken
为空。
最终ServiceStack
和ServiceStack.Core
他们在我的情况下,在Windows相同的实现。
因此, 要解决这个问题,关键是要的依赖关系改变ServiceStack.Api.Swagger
和ServiceStack.Kestrel
从ServiceStack
家庭ServiceStack.Core
家庭。
所述第一步骤是将组件的文件复制到一个packages
的参考方式从项目文件夹和改变PackageReference
到Reference
。 在此之后,的NuGet犯规任何更多的管理他们,我们可以通过修改组件。
现在,在编译像下面不同的错误的项目成果。
Error CS0012 The type 'IPlugin' is defined in an assembly that is not referenced. You must add a reference to assembly 'ServiceStack, Version=5.0.0.0, Culture=neutral, PublicKeyToken=02c12cbda47e6587'.
Error CS0012 The type 'IPreInitPlugin' is defined in an assembly that is not referenced. You must add a reference to assembly 'ServiceStack, Version=5.0.0.0, Culture=neutral, PublicKeyToken=02c12cbda47e6587'.
它们是由产生ServiceStack.Api.Swagger
,因为它试图链接到的类型ServiceStack
。 事实上,此同一类型存在ServiceStack.Core
总成,其publicKeyToken
为空。
现在,我把使用的工具reflexil编辑ServiceStack.Api.Swagger.dll
选择ServiceStack依赖和清除其publicKeyToken
,因为它是在屏幕截图呈现之上。
编译现在一切正常,我不改变任何代码。
根问题是ServiceStack改变从依赖ServiceStack.Core
家庭ServiceStack
家庭。
我个人建议ServiceStack释放的另一个平行包ServiceStack.Api.Swagger.Core
取决于5.0.2 ServiceStack.Core
。