I am trying to delete a .mdf file in Visual Studio 2012 and i am getting this error “The process cannot access the file because it is being used by another process”. I have tried some of the similar posts on this issue but i have found no help as each of the other posts is dealing with a different process.
Any help will be highly appreciated.
I figured what I needed to do. Deleting file within Visual Studio 2012 will not give an error that could help you solve the problem so;
What i did was try to delete the .mdf file in windows explorer and then i gave me an error that SQL Server 2008 R2 was in fact holding on to the file even though i had the database deleted. Once i new that, all i had to do was shutdown SQL Server 2008 R2 and tried to delete the file again and it worked.
If you need instructions on how to turn on and off SQL Server 2008 R2, see link below.
Turn on and off SQL Server