gpt4 book ai didi

sql-server - 加载使用 sgen 实用程序创建的 XMLSerializers 时,SQL Server "version, culture or public key mismatch"在 "create assembly"期间

转载 作者:行者123 更新时间:2023-12-04 17:41:09 25 4
gpt4 key购买 nike

我正在尝试在 SQLServer 中创建一个调用 Web 服务的 CLR 函数。当我创建第一个程序集时,AssemblyInfo.cs 中的 AssemblyVersion 是 1.0.*。我将运行 sgen 来创建随附的 XMLSerializers 程序集,并且我没有看到任何问题。

>"C:\Program Files\Microsoft SDKs\Windows\v7.0\Bin\sgen.exe" /force /assembly:Ra
elen.DemoCLRFunction.dll
Microsoft (R) Xml Serialization support utility
[Microsoft (R) .NET Framework, Version 2.0.50727.3038]
Copyright (C) Microsoft Corporation. All rights reserved.
Serialization Assembly Name: Raelen.DemoCLRFunction.XmlSerializers, Version=1.0.
3868.13304, Culture=neutral, PublicKeyToken=null.
Generated serialization assembly for assembly C:\dev\freight-workspace\Raelen.De
moCLRFunction\Raelen.DemoCLRFunction\bin\Debug\Raelen.DemoCLRFunction.dll --> 'C
:\dev\freight-workspace\Raelen.DemoCLRFunction\Raelen.DemoCLRFunction\bin\Debug\
Raelen.DemoCLRFunction.XmlSerializers.dll'.

在 SQLServer 中,第一个程序集加载正常,但在尝试加载 XMLSerializers 程序集时出现以下错误:

Msg 10300, Level 16, State 2, Line 7
Assembly 'Raelen.DemoCLRFunction.XmlSerializers' references assembly
'raelen.democlrfunction, version=0.0.0.0, culture=neutral, publickeytoken=null.',
which is not present in the current database. SQL Server attempted to locate and
automatically load the referenced assembly from the same location where
referring assembly came from, but that operation has failed (reason: version,
culture or public key mismatch). Please load the referenced assembly into the
current database and retry your request.

我不明白为什么它试图引用版本 0.0.0.0。这确实是错误的原因吗?如果是,为什么 XMLSerializers 程序集引用了错误的版本号?

最佳答案

我也遇到过这个问题,最后我解决了。我正在引用 64 位服务器上的 x86 程序集。我将引用的程序集重建为任何 CPU,安装在服务器上,重新添加对项目的引用,将我的项目重建为任何 CPU,然后 SQL Server 可以解析引用并安装程序集.

类似“您正在引用为错误平台构建的程序集”的消息会非常有用:)

关于sql-server - 加载使用 sgen 实用程序创建的 XMLSerializers 时,SQL Server "version, culture or public key mismatch"在 "create assembly"期间,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3405631/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com