Unable to copy file reference.dll to bin/reference.dll. The process cannot access the file reference.dll because it is being used by another process

后端 未结 30 2065
深忆病人
深忆病人 2021-01-31 03:34

For one of my ASP.NET 3.5 applications, every single time I try to build the web app, it throws the following build errors in Visual Studio 2008:

Error 16

相关标签:
30条回答
  • 2021-01-31 04:12

    Removing the following lines from my app.config solved this for me - I'm using VS2010.

    <runtime>
      <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
          <dependentAssembly>
              <assemblyIdentity name="nunit.framework" publicKeyToken="96D09A1EB7F44A77" culture="neutral"/>
              <bindingRedirect oldVersion="0.0.0.0-2.5.7.10213" newVersion="2.5.7.10213"/>
          </dependentAssembly>
      </assemblyBinding>
    </runtime>
    
    0 讨论(0)
  • 2021-01-31 04:12

    I had similar issue and was able to resolve it by changing the 'AssemblyInfo.cs'

    Visual Studio build fails: unable to copy exe-file from obj\debug to bin\debug

    0 讨论(0)
  • 2021-01-31 04:13

    The issue ended up being that in the web.config someone had added:

    hostingEnvironment shadowCopyBinAssemblies="false"
    

    After commenting this out, everything started building ok. What a nightmare!!

    0 讨论(0)
  • 2021-01-31 04:13

    I have battled this issue FOR YEARS!

    Have you tried adding this to your PREBUILD Event?

    if exist "$(TargetPath).locked" del "$(TargetPath).locked"
    if exist "$(TargetPath)" if not exist "$(TargetPath).locked" move "$(TargetPath)" "$(TargetPath).locked"
    

    See this for more info: http://nayyeri.net/file-lock-issue-in-visual-studio-when-building-a-project

    Here's another thread, with more things to try...

    http://social.msdn.microsoft.com/forums/en-US/Vsexpressinstall/thread/5b71eb06-5047-483d-8fd3-b75c102d41e9/?prof=required

    0 讨论(0)
  • 2021-01-31 04:14

    This issue commonly occurs when you change your project from one directory to another . For the Shadow copy error you might have added this line in your web.config.To fix this follow the following

    In your web.config file if there is something like

    <hostingEnvironment shadowCopyBinAssemblies="false" />

    change that into

    <hostingEnvironment shadowCopyBinAssemblies="true" />

    or remove it .Then it will work fine

    0 讨论(0)
  • 2021-01-31 04:15

    Use ProcessExplorer to find out what process has the file open and go from there.

    If a process is currently using those DLL, you can't delete and re-write it. You'll have to kill or otherwise stop the process using those DLLs while you compile.

    0 讨论(0)
提交回复
热议问题