.NET Standard 2.0 bin Files getting locked - Unable to build or clean

Dan Patten 0 Reputation points

I cannot recreate this on command but ever since last week a .net standard 2.0 file is getting locked in the bin folder. For example I have 2 projects:


Once in a while one of the two above project dll's will get locked, other files in the folder are fine but the one dll cannot be deleted or moved. This results in visual studio being unable to build or clean.

Lock handlers show the file as locked by System (PID 4) with no additional info.

This files are deployed to IIS (not express) and killing the app pool SOMETIMES releases the lock.

The only surefire solution is to restart the computer, also have noticed the lock gets released after 30 minutes or so. Any help is much appreciated!

Microsoft Technologies based on the .NET software framework.
3,638 questions
Visual Studio
Visual Studio
A family of Microsoft suites of integrated development tools for building applications for Windows, the web and mobile devices.
4,879 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Anna Xiu-MSFT 27,816 Reputation points Microsoft Vendor

    Hi @Dan Patten, 

    Welcome to Microsoft Q&A! 

    Which version of Visual Studio are you using? Please update your Visual Studio to the latest version. 

    Meanwhile, please check if your projects use the same target framework or not. 



    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment". 
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.