简体   繁体   English

由于 VS2017 中的文件锁定,无法发布 ASP.Net Razor 应用程序

[英]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.

相关问题 在VS2017 ASP.NET中找不到在哪里启用SSL - Can't find where to enable SSL in VS2017 ASP.NET VS2017中使用Crystal Reports错误&#39;Invalid Subreport Name&#39;的Asp.Net应用 - Asp.Net app in VS2017 using Crystal Reports error 'Invalid Subreport Name' 在ASP.NET MVC 5项目中在VS2017中连接到MySQL - Connecting to MySQL in VS2017 in ASP.NET MVC 5 project NET Core 从 DLL 加载接口获取错误找不到文件 (VS2017 RC) - NET Core loading interfaces from DLL get error can't find the file (VS2017 RC) 试图发布ASP.NET项目,但VS找不到特定的文件 - Trying to publish ASP.NET project, but VS can't find a particular file ASP.NET Core 1.1无法发布应用程序 - ASP.NET Core 1.1 can't Publish App 将asp.net核心React-Redux WebApp从VS2017迁移到Visual Studio Code? - Migrate asp.net core React-Redux WebApp from VS2017 to Visual Studio Code? VS2017 MSBuildWorkspace无法使用转换后的ASP.Net Core Web应用程序打开解决方案 - VS2017 MSBuildWorkspace fails opening solution with converted ASP.Net Core Web application asp.net c# vs2017 javascript Eval 传递参数问题 - asp.net c# vs2017 javascript Eval passing parameter problem Asp.net Crystal Reports对子报表的更改未在vs2017调试/发布模式下显示 - Asp.net Crystal Reports changes to child reports not showing in vs2017 debug/release mode
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM