I keep getting this error during the build of my VS2012 C# project Error 41 Could not copy 'objDebugWeinGartner.WeinCad.exe' to'binDebugWeinGartner.WeinCad.exe'.Exceeded retry count of 10. Failed.Error 42 Unable to copy file 'objDebugWeinGartner.WeinCad.exe' to'binDebugWeinGartner.WeinCad.exe'. The process cannot access the file'binDebugWeinGartner.WeinCad.exe' because it is being used by anotherprocess.Now I've figured out that killing the process Weingartner.WeinCad.vhost.exeworks (sometimes ) but this is getting on my nerves. Any way to stop this happening at all?My debugger settings are. I have encountered similar error messages in Visual Studio 2013.Mostly, I have found that this situation has occurred when a debug process was halted because of an exception.When clean+build has not resolved this problem for me, I have had success by doing the following:. Closing Visual Studio.
Deleting the bin and obj folders, and. Reopening Visual Studio.This 'bug' has existed since Visual Studio 2003.Finally, I have also found that I can often overcome this problem by simply renaming the executable file and then deleting it. In Visual Studio Premium 2013 (Update 3), I solved this with a pre-build one-liner: (if exist '$(TargetDir).old.pdb' del '$(TargetDir).old.pdb') & (if exist '$(TargetDir).pdb' ren '$(TargetDir).pdb'.old.pdb)This gracefully deletes any old PDB files (if it can), then renames anything that's left with a.old.pdb extension. The.vhost.exe is a debugger process, so it appears that the process being debugged hasn't closed properly. Chances are you have a bug that's keeping it alive and are not stopping the debug process correctly - there are options to detach from the process when you click 'stop debugging' instead of actually killing the debugger so maybe you have that set.But that's the problem - the file you're trying to copy over is locked (ie still being used) by the OS so its preventing the copy. Ensure that file is free and you'll be able to copy. ExceptionIn some cases in Visual Studio when you (Build Rebuild) on top ofrunning IISExpress you faced with this Exception:Unable to copy file 'objDebugYourProjectName.dll' to binYourProjectName.dll'.
The process cannot access the file'binYourProjectName.dll' because it is being used by anotherprocess Solution. Right click on web project that needs to build. Click on properties. Select Build Events Tab on the left side.
In Pre-build events command line paste these 2 line:tasklist /fi 'imagename eq iisexpress.exe' find ':' nulif errorlevel 1 taskkill /f /im 'iisexpress.exe'You are good 2 GO!
I am working on a WPF, C# 3.0 project, and I get this error: Error 1 Metadata file'WORK=- ToolsVersionManagementSystemBusinessLogicLayerbinDebugBusinessLogicLayer.dll' could not be found C:-=WORK=- ToolsVersionManagementSystemVersionManagementSystemCSC VersionManagementSystemThis is how I reference my usercontrols: xmlns:vms='clr-namespace:VersionManagementSystem'It happens after every failed build. The only way I can get the solution to compile is to comment out all my user controls and re-build the project, and then I uncomment the usercontrols and everything is fine.I have checked build orders and dependencies configurations.As you can see, it seems to have truncated the DLL file's absolute path.
I have read that there is a bug with the length. Is this a possible problem?It's very annoying and having to comment, build, and uncomment, the build is becoming extremely tiresome. I tried all the answers above and unfortunately nothing worked in my case. I encountered with 2 errors 1. Missing.dll file 2. Method already defined at another place with same parameters I have cleared the second error first by removing the function which has been duplicated at another place.
My first error - that is.dll file missing has solved on its own. I want to say if you have more than single error along with.dll missing file error! Please try to solve the other errors first. May be.dll error solves on it own!–Oct 14 '16 at 12:30. I just had the same problem.
Visual Studio isn't building the project that's being referenced. Written Instructions:. Right click on the solution and click Properties. Click Configuration on the left. Make sure the check box under 'Build' for the project it can't find is checked.
If it is already checked, uncheck, hit apply and check the boxes again. (Optional) You had to do it for both Release and Debug modes on the solution properties.Screen capture Instructions:. They say a picture is worth a thousand words. Click on the GIF to zoom in, and hopefully it will be easy to follow. This can still happen in newer versions of Visual Studio (I just had it happen on Visual Studio 2013):Another thing to try is to close Visual Studio and delete the.suo file that is next to the.sln file. (It will be re-generated the next time you Save all (or exit Visual Studio)).I've had this problem when adding new projects to the solution on another machine and then pulling the revisions in, but the.suo file can be corrupted in other cases as well and lead to very strange Visual Studio behaviour, so deleting it is one of the things I always try.Note that deleting the.suo file will reset the startup project(s) of the solution.More on the.suo file is.
Well, my answer is not just the summary of all the solutions, but it offers more than that.Section (1):In general solutions:I had four errors of this kind (‘metadata file could not be found’) along with one error saying 'Source File Could Not Be Opened (‘Unspecified error ‘)'.I tried to get rid of ‘metadata file could not be found’ error. For that, I read many posts, blogs, etc. And found these solutions may be effective (summarizing them over here):.Restart Visual Studio and try building again.Go to 'Solution Explorer'. Right click on Solution. Go to Properties. Go to 'Configuration Manager'. Check if the checkboxes under 'Build' are checked or not.
If any or all of them are unchecked, then check them and try building again.If the above solution(s) do not work, then follow sequence mentioned in step 2 above, and even if all the checkboxes are checked, uncheck them, check again and try to build again.Build Order and Project Dependencies:Go to 'Solution Explorer'. Right click on Solution. Go to 'Project Dependencies.' You will see two tabs: 'Dependencies' and 'Build Order'. This build order is the one in which solution builds. Check the project dependencies and the build order to verify if some project (say 'project1') which is dependent on other (say 'project2') is trying to build before that one (project2).
This might be the cause for the error.Check the path of the missing.dll:Check the path of the missing.dll. If the path contains space or any other invalid path character, remove it and try building again.If this is the cause, then adjust the build order.Section (2):My particular case:I tried all the steps above with various permutations and combinations with restarting Visual Studio a few times.
But, it did not help me.So, I decided to get rid of other error I was coming across ('Source File Could Not Be Opened (‘Unspecified error ‘)').I came across a blog post:I tried the steps mentioned in that blog post, and I got rid of the error 'Source File Could Not Be Opened (‘Unspecified error ‘)' and surprisingly I got rid of other errors (‘metadata file could not be found’) as well.Section (3):Moral of the story:Try all solutions as mentioned in section (1) above (and any other solutions) for getting rid of the error. If nothing works out, as per the blog mentioned in section (2) above, delete the entries of all source files which are no longer present in the source control and the file system from your.csproj file.