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 2208
深忆病人
深忆病人 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 03:51

    The file cannot be deleted, fortunately can be renamed and moved. So I created prebuild batch (using date and time as random string, there can be easier ways):

    For /f "Tokens=2,3,4 Delims=/. " %%i In ("%Date%") Do @(
      Set Month=%%i& Set Day=%%j& Set Year=%%k
    )
    
    set ActDate=%Year%-%Month%-%Day%
    
    For /f "Tokens=1,2,3 Delims=/.:, " %%i In ("%Time%") Do @(
      Set Hour=0%%i& Set Min=%%j& Set Sec=%%k
    )
    
    set ActTime=%Hour:~-2,2%-%Min%-%Sec%
    
    move c:\MyProject\bin\Debug\myproject.exe c:\garbage\%ActDate%_%ActTime%_myproject.exe
    

提交回复
热议问题