本文介绍了程序集正在被另一个进程使用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

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. 插入PreBuild事件以解锁程序集

  2. 已删除程序集版本通配符

  3. 禁用源代码步进

  4. 停止Windows搜索

  5. 停止IIS

  6. 退出vs2010,删除了sln.suo和bin / obj文件夹

  7. 现在已阅读博客和SO帖子3天了:)

  8. 从服务项目中删除了所有引用,并重新阅读了它们。

  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!

错误消息:

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

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票证:

推荐答案

好,所以我的同事休假回来并说他更早遇到了这个问题:)
似乎组件被锁定(或由构建过程控制)的根本原因是由于使用testaccessor测试私有方法,结合CodeAccessSecurityAttribute的实现。请注意,这在Visual Studio 2008中不是问题,而仅在2010年是
在这里看到另一种情况:

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 2010See another case here:

除了将私有方法更改为公共方法外,我还没有找到解决方案,我将创建一个新方法发布此问题。

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.

这篇关于程序集正在被另一个进程使用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-28 07:32