程序集正被另一个进程使用

发布于 2024-11-27 10:14:27 字数 1098 浏览 3 评论 0 原文

我已将运行 3.5 vs2008 的 WCF 项目升级到 .net 4.0 vs2010,但遇到了问题。当从 vs2010 编译时,我的服务实现项目中的程序集被 devenv.exe 锁定(注意没有调试 - 仅编译)。该程序集在vs2010重启时释放,每次重启后都可以编译一次。到目前为止我已经尝试过的操作:

  1. 插入 PreBuild 事件来解锁程序集
  2. 删除程序集版本通配符
  3. 禁用源步进
  4. 停止 Windows 搜索
  5. 停止 IIS
  6. 退出 vs2010,删除 sln.suo 和 bin/obj 文件夹
  7. 现在阅读博客和 SO 帖子 3 天: )
  8. 从服务项目中删除了所有引用并阅读了它们,

我几乎没有想法了,而且微软似乎没有对此进行解释,无法修复。任何想法将不胜感激!

错误信息:

无法复制文件“.....某些 路径...\Debug\HelperLibrary.Service.dll”到 “bin\Debug\HelperLibrary.Service.dll”。该进程无法访问 文件“bin\Debug\HelperLibrary.Service.dll”,因为它正在被使用 另一个进程。

奖金信息: 使用 msbuild 从提示符进行编译时,没有问题。仅当从 vs2010 编译时。旧的vs2008解决方案当然仍然有效。

Microsoft 票证: https://connect.microsoft.com/VisualStudio/feedback/details/682485/use-of-testaccessor-and-impl-of-codeaccesssecurityattribute-locks- assembly

I've upgraded a WCF project running 3.5 vs2008 to .net 4.0 vs2010 and run into a problem. When compiling from vs2010 an assembly in my service implementation project is locked by devenv.exe (note no debugging - only compiling). The assembly is released when vs2010 is restarted and can be compiled once, after each restart. What I've tried to far:

  1. Insert PreBuild event to unlock the assembly
  2. removed assembly version wild card
  3. Disabled source stepping
  4. stopped windows search
  5. stopped IIS
  6. quit vs2010, removed sln.suo and bin/obj folder
  7. Read blog and SO posts for 3 days now :)
  8. Removed all references from the service project and readded them

I've pretty much run out of ideas and it seems that Microsoft have no explaination for this an no fix. Any ideas would be greatly appreciated!

Error Message:

Unable to copy file ".....some
path...\Debug\HelperLibrary.Service.dll" to
"bin\Debug\HelperLibrary.Service.dll". The process cannot access the
file 'bin\Debug\HelperLibrary.Service.dll' because it is being used by
another process.

Bonus information:
When compiling from prompt with msbuild, there's no problem. Only when compiling from vs2010. The old vs2008 solution of course still work.

Microsoft Ticket: https://connect.microsoft.com/VisualStudio/feedback/details/682485/use-of-testaccessor-and-impl-of-codeaccesssecurityattribute-locks-assembly

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

执手闯天涯 2024-12-04 10:14:27

这是一个不太可能的情况,但是您的 web.config 是否有可能有 'shadowCopyBinAssemblies' 设置为“false”?或者上游配置文件已关闭该设置?

我认为这可能会导致您所看到的问题。

This is a long shot, but is there any chance that your web.config has 'shadowCopyBinAssemblies' set to 'false'? Or that an upstream config file has that setting turned off?

I think that might cause the problem you're seeing.

凯凯我们等你回来 2024-12-04 10:14:27

好的,我的同事度假回来后说他早些时候遇到了这个问题:)
程序集被锁定(或由构建过程持有)的根本原因似乎是由于使用 testaccessors 结合 CodeAccessSecurityAttribute 的实现来测试私有方法。请注意,这在 Visual studio 2008 中不是问题,而仅在 2010 中出现
请参阅此处的另一个案例:

http://social.microsoft.com/Forums/en/Offtopic/thread/41ceebce-1ecf-4962-86d0-e68050df4a99

除了改变之外,我还没有找到解决方案将私有方法改为公共方法 - 我将针对此问题创建一个新帖子。

Ok, so my colleague gets back from vacation and said he bumped into this problem earlier :)
It seems that root cause for the assembly to be locked (or held by the building process), is due to the use of testaccessors to test private methods, in combination of an implementation of CodeAccessSecurityAttribute. Note that this is not a problem in Visual studio 2008, but only in 2010
See another case here:

http://social.microsoft.com/Forums/en/Offtopic/thread/41ceebce-1ecf-4962-86d0-e68050df4a99

I've yet to find a solution for this, besides altering the private methods to public - I'll create a new post for this problem.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文