[英]Can't publish ASP.Net Razor app because of locked file in VS2017
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.我有一个 ASP.Net Razor 网站,在过去的几年里我一直在改进并成功发布到我们的 Intranet。 I recently started using VS2017 with it without any problems.我最近开始使用 VS2017,没有任何问题。 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.我尝试重新启动我的机器并在 .vs\\ETF\\v15\\Server\\sqlite3 文件夹中重命名db.lock ,但是当我在 VS 中启动项目并尝试再次发布它时,它重新创建了db.lock文件(带有当前时间戳) ,并给我同样的错误。 I use SQL Server in the app, but have no idea where the sqlite3 reference is coming from.我在应用程序中使用 SQL Server,但不知道sqlite3引用来自哪里。 Also there is no db.lock file in the destination directory.目标目录中也没有db.lock文件。
Any ideas would be greatly appreciated as my online searches have been fruitless.任何想法将不胜感激,因为我的在线搜索毫无结果。
I ran into this exact problem after updating to Visual Studio 2017 Community from Visual Studio 2015 Pro.从 Visual Studio 2015 Pro 更新到 Visual Studio 2017 社区后,我遇到了这个确切的问题。 I also changed PCs in the upgrade.我还在升级中更换了 PC。 I found the solution to be the .vs folder wasn't hidden.我发现解决方案是 .vs 文件夹没有隐藏。 Change the attribute hidden for the entire folder and subfolders and that should fix your problem.更改整个文件夹和子文件夹的隐藏属性,这应该可以解决您的问题。
Need to add this line in your publish profile (blabla.pubxml file):需要在您的发布配置文件(blabla.pubxml 文件)中添加这一行:
<ExcludeFoldersFromDeployment>.vs</ExcludeFoldersFromDeployment>
Like the following:像下面这样:
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
...
<ExcludeFoldersFromDeployment>.vs</ExcludeFoldersFromDeployment>
...
</PropertyGroup>
</Project>
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.然后我关闭了 VS 并删除了 .VS/project name 文件夹。 Started VS back up and published the web app.启动 VS 备份并发布 Web 应用程序。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.