none
Can't publish ASP.Net Razor app because of locked file in VS2017

    Question

  • I have an ASP.Net Razor web site that I've been enhancing and successfully publishing to our intranet for the last couple of years. I recently started using VS2017 with it without any problems. Today, I encountered an error when I tried to publish it:

    Error       Copying file .vs\ETF\v15\Server\sqlite3\db.lock to C:\Users\myId\AppData\Local\Temp\WebSitePublish\mySite-1436350714\obj\Debug\Package\PackageTmp\.vs\ETF\v15\Server\sqlite3\db.lock failed. The process cannot access the file '.vs\ETF\v15\Server\sqlite3\db.lock' because it is being used by another process.

    I tried restarting my machine and renaming db.lock in the .vs\ETF\v15\Server\sqlite3 folder, but when I start the project in VS and try to publish it again, it recreates db.lock file (with current timestamp), and gives me the same error. I use SQL Server in the app, but have no idea where the sqlite3 reference is coming from. Also there is no db.lock file in the destination directory.

    Any ideas would be greatly appreciated as my online searches have been fruitless.
    Wednesday, January 03, 2018 10:13 PM

All replies

  • Hi,

    >>I recently started using VS2017 with it without any problems. Today, I encountered an error when I tried to publish it

    Can you build the project successfully?

    If not, please have a look at the thread:

    Try to add the .vs folder in the .gitignore.

    You could use this one: https://github.com/github/gitignore/blob/master/VisualStudio.gitignore

    If you have any trouble adding the .gitignore, you could follow this article: https://elanderson.net/2016/09/add-git-ignore-to-existing-visual-studio-project/

    If you can build it, and error just occurs when you publish it, please go to Microsoft asp.net forum to open a new thread to talk about it.

    Best regards,

    Joyce


    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Thursday, January 04, 2018 8:54 AM
  • Yes I can build it. We don't use Git anymore, we switched to TFS.

    Should I just remove the Git related files (.gitattributes amd .gitignore)?

    If you can't answer, I'll start a new thread in the asp.net forum.

    Thank you!

    Thursday, January 04, 2018 3:55 PM
  • Hi,

    Thank you for the update.

    It is recommend that go to asp.net forum to talk about it, if you have problems about visual studio IDE, please feel free to let me know.

    Best regards,

    Joyce


    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Friday, January 05, 2018 7:26 AM
  • Will do. Thanks.
    Friday, January 05, 2018 3:15 PM
  • I had a similar issues when upgrading to VS2017. On another project that published correctly, my .vs folder was a hidden folder in windows. When I changed the .vs folder to hidden on my 'problem' project, I was able to publish without the db.lock error. Just a thought.  
    • Proposed as answer by Cindy A Wednesday, February 14, 2018 11:04 AM
    Friday, January 05, 2018 5:46 PM