Reputation: 398
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.
Upvotes: 2
Views: 2229
Reputation: 163
Need to add this line in your publish profile (blabla.pubxml file):
<ExcludeFoldersFromDeployment>.vs</ExcludeFoldersFromDeployment>
Like the following:
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
...
<ExcludeFoldersFromDeployment>.vs</ExcludeFoldersFromDeployment>
...
</PropertyGroup>
</Project>
Upvotes: 1
Reputation: 69
To resolve this issue, simply uncheck the "Allow precompiled site to be updatable" option in your publish profile settings. Then I shutdown VS and deleted the .VS/project name folder. Started VS back up and published the web app.
Upvotes: 0
Reputation: 151
I ran into this exact problem after updating to Visual Studio 2017 Community from Visual Studio 2015 Pro. I also changed PCs in the upgrade. I found the solution to be the .vs folder wasn't hidden. Change the attribute hidden for the entire folder and subfolders and that should fix your problem.
Upvotes: 11