Visual Studio无法生成,因为dotnet.exe是锁定文件 [英] Visual Studio cannot build because dotnet.exe is locking files
问题描述
在我运行我的解决方案之后,特别是在调试它时,然后停止执行,几个DLL被dotnet.exe进程锁定,导致后续构建失败(因为无法清除解决方案)。
此外,无法手动删除锁定的DLL,并且无法终止dotnet.exe进程(即使具有管理员权限,访问被拒绝错误)。注销后,这种情况仍然存在。重新启动计算机只能暂时解决问题。
额外信息:我使用的是Windows 7 Professional 64位,Visual Studio Enterprise 2017,.NetCore 2.1。
--------------
Microsoft Visual Studio Enterprise 2017
版本15.7.5
VisualStudio.15.Release / 15.7.5 + 27703.2042
Microsoft .NET Framework
版本4.7.02558
已安装版本:企业版
ASP.NET和Web Tools 2017 15.0.40625.0
ASP.NET和Web Tools 2017
$
ASP.NET Core Razor语言服务 15.7.31476
为ASP.NET Core Razor提供语言服务。
ASP.NET Web框架和工具2017 5.2.60618.0
有关其他信息,请访问https://www.asp.net/
Azure App Service Tools v3。 0.0  15.0.40608.0
Azure App Service Tools v3.0.0
$
C#Tools   2.8.3-beta6-63029-08。 Commit Hash:e9a3a6c0ba5b1fde8b1fff964bdfb3fb768ee2eb
IDE中使用的C#组件。根据您的项目类型和设置,可能会使用不同版本的编译器。
常见的Azure工具 1.10
提供Azure移动服务和Microsoft Azure工具使用的通用服务。
GhostDoc 5.9.18070.0
从代码生成XML注释,维护干净和最新的文档,生成多种格式的帮助文档,在Visual Studio中使用智能源代码拼写检查器。
GitHub.VisualStudio 2.5.4.3349
将GitHub Flow引入Visual Studio的Visual Studio扩展。
JavaScript语言服务 2.0
JavaScript语言服务
$
JetBrains ReSharper Ultimate 2017.2.2   Build 109.0.20171006.122324
适用于Microsoft Visual Studio的JetBrains ReSharper Ultimate软件包。有关ReSharper Ultimate的更多信息,请访问http://www.jetbrains.com/resharper。版权所有©2018 JetBrains,Inc。
$
Markdown Editor 1.12.233
全功能Markdown编辑器,带有实时预览和语法高亮显示功能。支持GitHub风格的Markdown。
Microsoft Azure工具 2.9
用于Microsoft Visual Studio 2017的Microsoft Azure工具 - v2.9.10420.2
用于Visual Studio的Microsoft持续交付工具 0.3
从Visual Studio IDE中简化连续构建集成和持续构建交付的配置。
Microsoft JVM调试器 1.0
支持将Visual Studio调试器连接到JDWP兼容的Java虚拟机
基于Microsoft MI的调试器 1.0
支持将Visual Studio连接到MI兼容的调试器
用于容器的Microsoft Visual Studio工具 1.1
在目标环境中开发,运行,验证ASP.NET Core应用程序。 F5你的应用程序直接进入带调试的容器,或CTRL + F5进行编辑&刷新您的应用程序而无需重建容器。
NuGet包管理器 4.6.0
Visual Studio中的NuGet包管理器。有关NuGet的更多信息,请访问http://docs.nuget.org/。
ProjectServicesPackage Extension 1.0
ProjectServicesPackage Visual Studio扩展详细信息
ResourcePackage Extension 1.0
ResourcePackage Visual Studio扩展详细信息
SQL Server数据工具 15.1.61804.210
Microsoft SQL Server数据工具
TypeScript工具 15.7.20419.2003
适用于Microsoft Visual Studio的TypeScript工具
Visual Basic工具   2.8.3-beta6-63029-08。 Commit Hash:e9a3a6c0ba5b1fde8b1fff964bdfb3fb768ee2eb
IDE中使用的Visual Basic组件。根据您的项目类型和设置,可能会使用不同版本的编译器。
Visual Studio代码调试适配器主机包 1.0
用于在Visual Studio中托管Visual Studio代码调试适配器的Interop层
< blockquote>
欢迎来到MSDN论坛。
您能否帮助我们确认此问题仅发生在您当前的项目或所有.net核心项目上?
您是否可以创建单个.net核心控制台项目,检查此问题是否仍然存在?
调试结束时,dotnet.exe将自动退出h输出窗口中的一些信息如下所示。
在项目调试结束后,你能检查dotnet.exe是否成功退出吗?
是否还有其他错误消息?
如果此问题仅发生在您当前的项目中,也许您可以尝试以下解决方法解决您的问题:
请尝试通过运行命令来杀死dotnet.exe进程:
taskkill / IM dotnet.exe / F / T 作为管理员。
或者您可以尝试添加Pre-b项目的uild事件命令行:
正确点击项目
选择属性
构建事件
Pre -build event命令行,添加以下命令:
taskkill / IM dotnet.exe / F / T 2> nul 1> nul
< span style ="font-size:medium">退出0
保存和构建
最好的问候,
修跨度>
After I run my solution, especially when debugging it, then stop the execution, several DLLs get locked by the dotnet.exe process, causing subsequent build to fail (because solution cannot be cleaned).
Also, locked DLLs cannot be deleted manually, and dotnet.exe process cannot be killed (access denied error even with admin rights). This condition persist even after a log off. Restarting the machine solves the issue only temporarily.
Extra info: I'm using Windows 7 Professional 64-bit, Visual Studio Enterprise 2017, .NetCore 2.1.
--------------
Microsoft Visual Studio Enterprise 2017
Version 15.7.5
VisualStudio.15.Release/15.7.5+27703.2042
Microsoft .NET Framework
Version 4.7.02558
Installed Version: Enterprise
ASP.NET and Web Tools 2017 15.0.40625.0
ASP.NET and Web Tools 2017
ASP.NET Core Razor Language Services 15.7.31476
Provides languages services for ASP.NET Core Razor.
ASP.NET Web Frameworks and Tools 2017 5.2.60618.0
For additional information, visit https://www.asp.net/
Azure App Service Tools v3.0.0 15.0.40608.0
Azure App Service Tools v3.0.0
C# Tools 2.8.3-beta6-63029-08. Commit Hash: e9a3a6c0ba5b1fde8b1fff964bdfb3fb768ee2eb
C# components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.
Common Azure Tools 1.10
Provides common services for use by Azure Mobile Services and Microsoft Azure Tools.
GhostDoc 5.9.18070.0
Generate XML Comments from your code, maintain clean and up-to-date documentation, produce help documentation in multiple formats, use intelligent source code Spell Checker in Visual Studio.
GitHub.VisualStudio 2.5.4.3349
A Visual Studio Extension that brings the GitHub Flow into Visual Studio.
JavaScript Language Service 2.0
JavaScript Language Service
JetBrains ReSharper Ultimate 2017.2.2 Build 109.0.20171006.122324
JetBrains ReSharper Ultimate package for Microsoft Visual Studio. For more information about ReSharper Ultimate, visit http://www.jetbrains.com/resharper. Copyright © 2018 JetBrains, Inc.
Markdown Editor 1.12.233
A full featured Markdown editor with live preview and syntax highlighting. Supports GitHub flavored Markdown.
Microsoft Azure Tools 2.9
Microsoft Azure Tools for Microsoft Visual Studio 2017 - v2.9.10420.2
Microsoft Continuous Delivery Tools for Visual Studio 0.3
Simplifying the configuration of continuous build integration and continuous build delivery from within the Visual Studio IDE.
Microsoft JVM Debugger 1.0
Provides support for connecting the Visual Studio debugger to JDWP compatible Java Virtual Machines
Microsoft MI-Based Debugger 1.0
Provides support for connecting Visual Studio to MI compatible debuggers
Microsoft Visual Studio Tools for Containers 1.1
Develop, run, validate your ASP.NET Core applications in the target environment. F5 your application directly into a container with debugging, or CTRL + F5 to edit & refresh your app without having to rebuild the container.
NuGet Package Manager 4.6.0
NuGet Package Manager in Visual Studio. For more information about NuGet, visit http://docs.nuget.org/.
ProjectServicesPackage Extension 1.0
ProjectServicesPackage Visual Studio Extension Detailed Info
ResourcePackage Extension 1.0
ResourcePackage Visual Studio Extension Detailed Info
SQL Server Data Tools 15.1.61804.210
Microsoft SQL Server Data Tools
TypeScript Tools 15.7.20419.2003
TypeScript Tools for Microsoft Visual Studio
Visual Basic Tools 2.8.3-beta6-63029-08. Commit Hash: e9a3a6c0ba5b1fde8b1fff964bdfb3fb768ee2eb
Visual Basic components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.
Visual Studio Code Debug Adapter Host Package 1.0
Interop layer for hosting Visual Studio Code debug adapters in Visual Studio
Hi,
Welcome to the MSDN forum.
Can you help us confirm that this issue only occurs on your current project or on all .net core projects?
Can you create a single .net core console project, check if this issue still occurs?
When debug ending, dotnet.exe will exits automatically with some info in Output window as below.
Can you check if dotnet.exe exits successfully after debug ending on your project?
Are there some other error messages?
If this issue only occurs on your current project, maybe you can try the following workaround to solve your issue:
Please try to kill dotnet.exe process via running the command: taskkill /IM dotnet.exe /F /T as administrator.
Or you can try to add Pre-build event command line for your project:
· Right click on project
· Choose Properties
· Build Events
· Pre-build event command line, add the following commands:
taskkill /IM dotnet.exe /F /T 2>nul 1>nul
Exit 0
· Save and build
Best regards,
Xiu
这篇关于Visual Studio无法生成,因为dotnet.exe是锁定文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!