Visual Studio 正在寻找错误版本的程序集
我正在编写一个自定义 WCF 代理生成器。它工作得很好,直到我添加了更多代码并更改了版本并退出了它。当我执行插件时,出现文件未找到 COM 错误。当我启动 Fuslogvw 时,它报告找不到具有不同版本和公钥的旧版本程序集。我是否做错了什么,我设法在 GAC 中找到正确的版本。
相关错误消息是这样的:
=== Pre-bind state information ===
LOG: User = xxxxx\xxxxxx
LOG: DisplayName = MyProxyAddin, Version=1.10.0.0, Culture=neutral, PublicKeyToken=385b6950f1bca43c
(Fully-specified)
LOG: Appbase = file:///C:/Program Files (x86)/Microsoft Visual Studio 10.0/Common7/IDE/
LOG: Initial PrivatePath = NULL
LOG: Dynamic Base = NULL
LOG: Cache Base = NULL
LOG: AppName = devenv.exe
Calling assembly : (Unknown).
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\devenv.exe.Config
LOG: Using host configuration file:
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\v4.0.30319\config\machine.config.
LOG: Post-policy reference: MyProxyAddin, Version=1.10.0.0, Culture=neutral, PublicKeyToken=385b6950f1bca43c
LOG: GAC Lookup was unsuccessful.
供您参考,我使用 GAC utils 在 GAC 中安装了程序集,并使用以下命令注册了程序集:
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\10.0\CLSID\{69cf4e9e-c755-408a-b407-117cc3acabec}]
@="MyProxyAddin.MyProxyGenerator"
"InprocServer32"="C:\\Windows\\SysWOW64\\mscoree.dll"
"Class"="MyProxyAddin.MyProxyGenerator"
"Assembly"="MyProxyAddin, Version=1.12.0.0, Culture=neutral, PublicKeyToken=3f2f3c47238a72fe"
"ThreadingModel"="Both"
[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\10.0\Generators\{164B10B9-B200-11D0-8C61-00A0C91E29D5}\My Proxy Generator]
@="My WCF Proxy Generator"
"CLSID"="{69cf4e9e-c755-408a-b407-117cc3acabec}"
"GeneratesDesignTimeSource"=dword:00000001
[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\10.0\Generators\{E6FDF8B0-F3D1-11D4-8576-0002A516ECE8}\My WCF Proxy Generator]
@="My WCF Proxy Generator"
"CLSID"="{69cf4e9e-c755-408a-b407-117cc3acabec}"
"GeneratesDesignTimeSource"=dword:00000001
[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\10.0\Generators\{FAE04EC1-301F-11d3-BF4B-00C04F79EFBC}\My WCF Proxy Generator]
@="My WCF Proxy Generator"
"CLSID"="{69cf4e9e-c755-408a-b407-117cc3acabec}"
"GeneratesDesignTimeSource"=dword:00000001
I'm writing a custom WCF proxy generator. Had it working perfectly until I added more code and changed the version and resigned it. When I executed the addin, I get file not found COM error. When I launched Fuslogvw it reported it couldn't find an the old version assembly with a different version and public key. Is there something I am doing wrong, I managed to find the correct version in the GAC.
The relevant error message is this:
=== Pre-bind state information ===
LOG: User = xxxxx\xxxxxx
LOG: DisplayName = MyProxyAddin, Version=1.10.0.0, Culture=neutral, PublicKeyToken=385b6950f1bca43c
(Fully-specified)
LOG: Appbase = file:///C:/Program Files (x86)/Microsoft Visual Studio 10.0/Common7/IDE/
LOG: Initial PrivatePath = NULL
LOG: Dynamic Base = NULL
LOG: Cache Base = NULL
LOG: AppName = devenv.exe
Calling assembly : (Unknown).
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\devenv.exe.Config
LOG: Using host configuration file:
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\v4.0.30319\config\machine.config.
LOG: Post-policy reference: MyProxyAddin, Version=1.10.0.0, Culture=neutral, PublicKeyToken=385b6950f1bca43c
LOG: GAC Lookup was unsuccessful.
For your information, I installed my assembly in the GAC using GAC utils and registered the assembly using the following:
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\10.0\CLSID\{69cf4e9e-c755-408a-b407-117cc3acabec}]
@="MyProxyAddin.MyProxyGenerator"
"InprocServer32"="C:\\Windows\\SysWOW64\\mscoree.dll"
"Class"="MyProxyAddin.MyProxyGenerator"
"Assembly"="MyProxyAddin, Version=1.12.0.0, Culture=neutral, PublicKeyToken=3f2f3c47238a72fe"
"ThreadingModel"="Both"
[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\10.0\Generators\{164B10B9-B200-11D0-8C61-00A0C91E29D5}\My Proxy Generator]
@="My WCF Proxy Generator"
"CLSID"="{69cf4e9e-c755-408a-b407-117cc3acabec}"
"GeneratesDesignTimeSource"=dword:00000001
[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\10.0\Generators\{E6FDF8B0-F3D1-11D4-8576-0002A516ECE8}\My WCF Proxy Generator]
@="My WCF Proxy Generator"
"CLSID"="{69cf4e9e-c755-408a-b407-117cc3acabec}"
"GeneratesDesignTimeSource"=dword:00000001
[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\10.0\Generators\{FAE04EC1-301F-11d3-BF4B-00C04F79EFBC}\My WCF Proxy Generator]
@="My WCF Proxy Generator"
"CLSID"="{69cf4e9e-c755-408a-b407-117cc3acabec}"
"GeneratesDesignTimeSource"=dword:00000001
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果我正确理解了这个问题,则引用的程序集有一个新版本,但引用程序集仍在寻找它的旧版本。尝试删除 VS 中引用的程序集并添加对新程序集的引用。然后重建参考装配体。
If I understand the issue correctly, there is a new version of referenced assembly, but the referencing assembly is still looking for the old version of it. Try remove the referenced assembly in VS and add reference to the new one. Then rebuild the referencing assembly.