Visual Studio 2017 在调试期间出现异常后需要重启

3
我在Visual Studio 2017(版本15.7.1)中遇到了一个奇怪的问题。在调试会话期间发生异常后,Visual Studio无法构建。这在使用net462的WebApi项目中发生。其中一个正在使用的库是一个使用Entity Framework 6、Automapper和LinqKit构建的自定义库,该库使用.NET 4.6.2。
在异常发生后,如果我尝试进行构建,就会出现以下构建错误,我必须重新启动Visual Studio才能成功构建:
1>Build FAILED.
1>
1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\Microsoft.Common.CurrentVersion.targets(5033,5): warning MSB3061: Unable to delete file "C:\PATH_TO_PROJECT_FOLDER\bin\Debug\net462\WebApiApplication.exe". Access to the path 'C:\PATH_TO_PROJECT_FOLDER\bin\Debug\net462\WebApiApplication.exe' is denied.
1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\Microsoft.Common.CurrentVersion.targets(5033,5): warning MSB3061: Unable to delete file "C:\PATH_TO_PROJECT_FOLDER\bin\Debug\net462\AutoMapper.dll". Access to the path 'C:\PATH_TO_PROJECT_FOLDER\bin\Debug\net462\AutoMapper.dll' is denied.
1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\Microsoft.Common.CurrentVersion.targets(5033,5): warning MSB3061: Unable to delete file "C:\PATH_TO_PROJECT_FOLDER\bin\Debug\net462\EntityFramework.SqlServer.dll". Access to the path 'C:\PATH_TO_PROJECT_FOLDER\bin\Debug\net462\EntityFramework.SqlServer.dll' is denied.
1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\Microsoft.Common.CurrentVersion.targets(5033,5): warning MSB3061: Unable to delete file "C:\PATH_TO_PROJECT_FOLDER\bin\Debug\net462\EntityFramework.dll". Access to the path 'C:\PATH_TO_PROJECT_FOLDER\bin\Debug\net462\EntityFramework.dll' is denied.
1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\Microsoft.Common.CurrentVersion.targets(5033,5): warning MSB3061: Unable to delete file "C:\PATH_TO_PROJECT_FOLDER\bin\Debug\net462\Microsoft.AspNetCore.DataProtection.dll". Access to the path 'C:\PATH_TO_PROJECT_FOLDER\bin\Debug\net462\Microsoft.AspNetCore.DataProtection.dll' is denied.
1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\Microsoft.Common.CurrentVersion.targets(5033,5): warning MSB3061: Unable to delete file "C:\PATH_TO_PROJECT_FOLDER\bin\Debug\net462\Microsoft.AspNetCore.Diagnostics.dll". Access to the path 'C:\PATH_TO_PROJECT_FOLDER\bin\Debug\net462\Microsoft.AspNetCore.Diagnostics.dll' is denied.
1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\Microsoft.Common.CurrentVersion.targets(5033,5): warning MSB3061: Unable to delete file "C:\PATH_TO_PROJECT_FOLDER\bin\Debug\net462\Microsoft.AspNetCore.Hosting.dll". Access to the path 'C:\PATH_TO_PROJECT_FOLDER\bin\Debug\net462\Microsoft.AspNetCore.Hosting.dll' is denied.
1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\Microsoft.Common.CurrentVersion.targets(5033,5): warning MSB3061: Unable to delete file "C:\PATH_TO_PROJECT_FOLDER\bin\Debug\net462\Microsoft.AspNetCore.Http.dll". Access to the path 'C:\PATH_TO_PROJECT_FOLDER\bin\Debug\net462\Microsoft.AspNetCore.Http.dll' is denied.
1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\Microsoft.Common.CurrentVersion.targets(5033,5): warning MSB3061: Unable to delete file "C:\PATH_TO_PROJECT_FOLDER\bin\Debug\net462\Microsoft.AspNetCore.Http.Abstractions.dll". Access to the path 'C:\PATH_TO_PROJECT_FOLDER\bin\Debug\net462\Microsoft.AspNetCore.Http.Abstractions.dll' is denied.
1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\Microsoft.Common.CurrentVersion.targets(5033,5): warning MSB3061: Unable to delete file "C:\PATH_TO_PROJECT_FOLDER\bin\Debug\net462\Microsoft.AspNetCore.Mvc.Abstractions.dll". Access to the path 'C:\PATH_TO_PROJECT_FOLDER\bin\Debug\net462\Microsoft.AspNetCore.Mvc.Abstractions.dll' is denied.
1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\Microsoft.Common.CurrentVersion.targets(5033,5): warning MSB3061: Unable to delete file "C:\PATH_TO_PROJECT_FOLDER\bin\Debug\net462\Microsoft.AspNetCore.Mvc.Core.dll". Access to the path 'C:\PATH_TO_PROJECT_FOLDER\bin\Debug\net462\Microsoft.AspNetCore.Mvc.Core.dll' is denied.
1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\Microsoft.Common.CurrentVersion.targets(5033,5): warning MSB3061: Unable to delete file "C:\PATH_TO_PROJECT_FOLDER\bin\Debug\net462\Microsoft.AspNetCore.Mvc.Razor.dll". Access to the path 'C:\PATH_TO_PROJECT_FOLDER\bin\Debug\net462\Microsoft.AspNetCore.Mvc.Razor.dll' is denied.
1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\Microsoft.Common.CurrentVersion.targets(5033,5): warning MSB3061: Unable to delete file "C:\PATH_TO_PROJECT_FOLDER\bin\Debug\net462\Microsoft.AspNetCore.Mvc.Razor.Extensions.dll". Access to the path 'C:\PATH_TO_PROJECT_FOLDER\bin\Debug\net462\Microsoft.AspNetCore.Mvc.Razor.Extensions.dll' is denied.
1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\Microsoft.Common.CurrentVersion.targets(5033,5): warning MSB3061: Unable to delete file "C:\PATH_TO_PROJECT_FOLDER\bin\Debug\net462\Microsoft.AspNetCore.Mvc.RazorPages.dll". Access to the path 'C:\PATH_TO_PROJECT_FOLDER\bin\Debug\net462\Microsoft.AspNetCore.Mvc.RazorPages.dll' is denied.
1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\Microsoft.Common.CurrentVersion.targets(5033,5): warning MSB3061: Unable to delete file "C:\PATH_TO_PROJECT_FOLDER\bin\Debug\net462\Microsoft.AspNetCore.Mvc.TagHelpers.dll". Access to the path 'C:\PATH_TO_PROJECT_FOLDER\bin\Debug\net462\Microsoft.AspNetCore.Mvc.TagHelpers.dll' is denied.
1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\Microsoft.Common.CurrentVersion.targets(5033,5): warning MSB3061: Unable to delete file "C:\PATH_TO_PROJECT_FOLDER\bin\Debug\net462\Microsoft.AspNetCore.Mvc.ViewFeatures.dll". Access to the path 'C:\PATH_TO_PROJECT_FOLDER\bin\Debug\net462\Microsoft.AspNetCore.Mvc.ViewFeatures.dll' is denied.
1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\Microsoft.Common.CurrentVersion.targets(5033,5): warning MSB3061: Unable to delete file "C:\PATH_TO_PROJECT_FOLDER\bin\Debug\net462\Microsoft.AspNetCore.Razor.Language.dll". Access to the path 'C:\PATH_TO_PROJECT_FOLDER\bin\Debug\net462\Microsoft.AspNetCore.Razor.Language.dll' is denied.
1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\Microsoft.Common.CurrentVersion.targets(5033,5): warning MSB3061: Unable to delete file "C:\PATH_TO_PROJECT_FOLDER\bin\Debug\net462\Microsoft.AspNetCore.Routing.dll". Access to the path 'C:\PATH_TO_PROJECT_FOLDER\bin\Debug\net462\Microsoft.AspNetCore.Routing.dll' is denied.
1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\Microsoft.Common.CurrentVersion.targets(5033,5): warning MSB3061: Unable to delete file "C:\PATH_TO_PROJECT_FOLDER\bin\Debug\net462\Microsoft.AspNetCore.Server.Kestrel.Core.dll". Access to the path 'C:\PATH_TO_PROJECT_FOLDER\bin\Debug\net462\Microsoft.AspNetCore.Server.Kestrel.Core.dll' is denied.
1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\Microsoft.Common.CurrentVersion.targets(5033,5): warning MSB3061: Unable to delete file "C:\PATH_TO_PROJECT_FOLDER\bin\Debug\net462\Microsoft.AspNetCore.Server.Kestrel.Transport.Abstractions.dll". Access to the path 'C:\PATH_TO_PROJECT_FOLDER\bin\Debug\net462\Microsoft.AspNetCore.Server.Kestrel.Transport.Abstractions.dll' is denied.
1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\Microsoft.Common.CurrentVersion.targets(5033,5): warning MSB3061: Unable to delete file "C:\PATH_TO_PROJECT_FOLDER\bin\Debug\net462\Microsoft.AspNetCore.Server.Kestrel.Transport.Libuv.dll". Access to the path 'C:\PATH_TO_PROJECT_FOLDER\bin\Debug\net462\Microsoft.AspNetCore.Server.Kestrel.Transport.Libuv.dll' is denied.
1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\Microsoft.Common.CurrentVersion.targets(5033,5): warning MSB3061: Unable to delete file "C:\PATH_TO_PROJECT_FOLDER\bin\Debug\net462\Microsoft.AspNetCore.StaticFiles.dll". Access to the path 'C:\PATH_TO_PROJECT_FOLDER\bin\Debug\net462\Microsoft.AspNetCore.StaticFiles.dll' is denied.
1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\Microsoft.Common.CurrentVersion.targets(5033,5): warning MSB3061: Unable to delete file "C:\PATH_TO_PROJECT_FOLDER\bin\Debug\net462\Microsoft.AspNetCore.WebUtilities.dll". Access to the path 'C:\PATH_TO_PROJECT_FOLDER\bin\Debug\net462\Microsoft.AspNetCore.WebUtilities.dll' is denied.
1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\Microsoft.Common.CurrentVersion.targets(5033,5): warning MSB3061: Unable to delete file "C:\PATH_TO_PROJECT_FOLDER\bin\Debug\net462\Microsoft.CodeAnalysis.dll". Access to the path 'C:\PATH_TO_PROJECT_FOLDER\bin\Debug\net462\Microsoft.CodeAnalysis.dll' is denied.
1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\Microsoft.Common.CurrentVersion.targets(5033,5): warning MSB3061: Unable to delete file "C:\PATH_TO_PROJECT_FOLDER\bin\Debug\net462\Microsoft.CodeAnalysis.CSharp.dll". Access to the path 'C:\PATH_TO_PROJECT_FOLDER\bin\Debug\net462\Microsoft.CodeAnalysis.CSharp.dll' is denied.
1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\Microsoft.Common.CurrentVersion.targets(5033,5): warning MSB3061: Unable to delete file "C:\PATH_TO_PROJECT_FOLDER\bin\Debug\net462\Microsoft.IdentityModel.Protocols.OpenIdConnect.dll". Access to the path 'C:\PATH_TO_PROJECT_FOLDER\bin\Debug\net462\Microsoft.IdentityModel.Protocols.OpenIdConnect.dll' is denied.
1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\Microsoft.Common.CurrentVersion.targets(5033,5): warning MSB3061: Unable to delete file "C:\PATH_TO_PROJECT_FOLDER\bin\Debug\net462\Microsoft.IdentityModel.Tokens.dll". Access to the path 'C:\PATH_TO_PROJECT_FOLDER\bin\Debug\net462\Microsoft.IdentityModel.Tokens.dll' is denied.
1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\Microsoft.Common.CurrentVersion.targets(5033,5): warning MSB3061: Unable to delete file "C:\PATH_TO_PROJECT_FOLDER\bin\Debug\net462\Microsoft.Net.Http.Headers.dll". Access to the path 'C:\PATH_TO_PROJECT_FOLDER\bin\Debug\net462\Microsoft.Net.Http.Headers.dll' is denied.
1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\Microsoft.Common.CurrentVersion.targets(5033,5): warning MSB3061: Unable to delete file "C:\PATH_TO_PROJECT_FOLDER\bin\Debug\net462\Microsoft.VisualStudio.Web.CodeGeneration.Core.dll". Access to the path 'C:\PATH_TO_PROJECT_FOLDER\bin\Debug\net462\Microsoft.VisualStudio.Web.CodeGeneration.Core.dll' is denied.
1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\Microsoft.Common.CurrentVersion.targets(5033,5): warning MSB3061: Unable to delete file "C:\PATH_TO_PROJECT_FOLDER\bin\Debug\net462\Microsoft.VisualStudio.Web.CodeGeneration.EntityFrameworkCore.dll". Access to the path 'C:\PATH_TO_PROJECT_FOLDER\bin\Debug\net462\Microsoft.VisualStudio.Web.CodeGeneration.EntityFrameworkCore.dll' is denied.
1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\Microsoft.Common.CurrentVersion.targets(5033,5): warning MSB3061: Unable to delete file "C:\PATH_TO_PROJECT_FOLDER\bin\Debug\net462\Microsoft.VisualStudio.Web.CodeGenerators.Mvc.dll". Access to the path 'C:\PATH_TO_PROJECT_FOLDER\bin\Debug\net462\Microsoft.VisualStudio.Web.CodeGenerators.Mvc.dll' is denied.
1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\Microsoft.Common.CurrentVersion.targets(5033,5): warning MSB3061: Unable to delete file "C:\PATH_TO_PROJECT_FOLDER\bin\Debug\net462\Newtonsoft.Json.dll". Access to the path 'C:\PATH_TO_PROJECT_FOLDER\bin\Debug\net462\Newtonsoft.Json.dll' is denied.
1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\Microsoft.Common.CurrentVersion.targets(5033,5): warning MSB3061: Unable to delete file "C:\PATH_TO_PROJECT_FOLDER\bin\Debug\net462\Swashbuckle.AspNetCore.SwaggerUI.dll". Access to the path 'C:\PATH_TO_PROJECT_FOLDER\bin\Debug\net462\Swashbuckle.AspNetCore.SwaggerUI.dll' is denied.
1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\Microsoft.Common.CurrentVersion.targets(5033,5): warning MSB3061: Unable to delete file "C:\PATH_TO_PROJECT_FOLDER\bin\Debug\net462\System.Collections.Immutable.dll". Access to the path 'C:\PATH_TO_PROJECT_FOLDER\bin\Debug\net462\System.Collections.Immutable.dll' is denied.
1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\Microsoft.Common.CurrentVersion.targets(5033,5): warning MSB3061: Unable to delete file "C:\PATH_TO_PROJECT_FOLDER\bin\Debug\net462\System.IdentityModel.Tokens.Jwt.dll". Access to the path 'C:\PATH_TO_PROJECT_FOLDER\bin\Debug\net462\System.IdentityModel.Tokens.Jwt.dll' is denied.
1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\Microsoft.Common.CurrentVersion.targets(5033,5): warning MSB3061: Unable to delete file "C:\PATH_TO_PROJECT_FOLDER\bin\Debug\net462\System.Numerics.Vectors.dll". Access to the path 'C:\PATH_TO_PROJECT_FOLDER\bin\Debug\net462\System.Numerics.Vectors.dll' is denied.
1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\Microsoft.Common.CurrentVersion.targets(5033,5): warning MSB3061: Unable to delete file "C:\PATH_TO_PROJECT_FOLDER\bin\Debug\net462\System.Net.Http.dll". Access to the path 'C:\PATH_TO_PROJECT_FOLDER\bin\Debug\net462\System.Net.Http.dll' is denied.
1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\Microsoft.Common.CurrentVersion.targets(5033,5): warning MSB3061: Unable to delete file "C:\PATH_TO_PROJECT_FOLDER\bin\Debug\net462\System.ValueTuple.dll". Access to the path 'C:\PATH_TO_PROJECT_FOLDER\bin\Debug\net462\System.ValueTuple.dll' is denied.
1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\Microsoft.Common.CurrentVersion.targets(5033,5): warning MSB3061: Unable to delete file "C:\PATH_TO_PROJECT_FOLDER\bin\Debug\net462\Camms.Wapi.Common.dll". Access to the path 'C:\PATH_TO_PROJECT_FOLDER\bin\Debug\net462\Camms.Wapi.Common.dll' is denied.
1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\Microsoft.Common.CurrentVersion.targets(5033,5): warning MSB3061: Unable to delete file "C:\PATH_TO_PROJECT_FOLDER\bin\Debug\net462\CAMMS.WAPI.Repository.dll". Access to the path 'C:\PATH_TO_PROJECT_FOLDER\bin\Debug\net462\CAMMS.WAPI.Repository.dll' is denied.
1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\Microsoft.Common.CurrentVersion.targets(5033,5): warning MSB3061: Unable to delete file "C:\PATH_TO_PROJECT_FOLDER\bin\Debug\net462\Oracle.ManagedDataAccess.EntityFramework.dll". Access to the path 'C:\PATH_TO_PROJECT_FOLDER\bin\Debug\net462\Oracle.ManagedDataAccess.EntityFramework.dll' is denied.
1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\Microsoft.Common.CurrentVersion.targets(4172,5): warning MSB3026: Could not copy "obj\Debug\net462\WebApiApplication.exe" to "bin\Debug\net462\WebApiApplication.exe". Beginning retry 1 in 1000ms. The process cannot access the file 'bin\Debug\net462\WebApiApplication.exe' because it is being used by another process. The file is locked by: "Microsoft Visual Studio 2017 (9520)"
1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\Microsoft.Common.CurrentVersion.targets(4172,5): warning MSB3026: Could not copy "obj\Debug\net462\WebApiApplication.exe" to "bin\Debug\net462\WebApiApplication.exe". Beginning retry 2 in 1000ms. The process cannot access the file 'bin\Debug\net462\WebApiApplication.exe' because it is being used by another process. The file is locked by: "Microsoft Visual Studio 2017 (9520)"
1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\Microsoft.Common.CurrentVersion.targets(4172,5): warning MSB3026: Could not copy "obj\Debug\net462\WebApiApplication.exe" to "bin\Debug\net462\WebApiApplication.exe". Beginning retry 3 in 1000ms. The process cannot access the file 'bin\Debug\net462\WebApiApplication.exe' because it is being used by another process. The file is locked by: "Microsoft Visual Studio 2017 (9520)"
1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\Microsoft.Common.CurrentVersion.targets(4172,5): warning MSB3026: Could not copy "obj\Debug\net462\WebApiApplication.exe" to "bin\Debug\net462\WebApiApplication.exe". Beginning retry 4 in 1000ms. The process cannot access the file 'bin\Debug\net462\WebApiApplication.exe' because it is being used by another process. The file is locked by: "Microsoft Visual Studio 2017 (9520)"
1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\Microsoft.Common.CurrentVersion.targets(4172,5): warning MSB3026: Could not copy "obj\Debug\net462\WebApiApplication.exe" to "bin\Debug\net462\WebApiApplication.exe". Beginning retry 5 in 1000ms. The process cannot access the file 'bin\Debug\net462\WebApiApplication.exe' because it is being used by another process. The file is locked by: "Microsoft Visual Studio 2017 (9520)"
1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\Microsoft.Common.CurrentVersion.targets(4172,5): warning MSB3026: Could not copy "obj\Debug\net462\WebApiApplication.exe" to "bin\Debug\net462\WebApiApplication.exe". Beginning retry 6 in 1000ms. The process cannot access the file 'bin\Debug\net462\WebApiApplication.exe' because it is being used by another process. The file is locked by: "Microsoft Visual Studio 2017 (9520)"
1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\Microsoft.Common.CurrentVersion.targets(4172,5): warning MSB3026: Could not copy "obj\Debug\net462\WebApiApplication.exe" to "bin\Debug\net462\WebApiApplication.exe". Beginning retry 7 in 1000ms. The process cannot access the file 'bin\Debug\net462\WebApiApplication.exe' because it is being used by another process. The file is locked by: "Microsoft Visual Studio 2017 (9520)"
1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\Microsoft.Common.CurrentVersion.targets(4172,5): warning MSB3026: Could not copy "obj\Debug\net462\WebApiApplication.exe" to "bin\Debug\net462\WebApiApplication.exe". Beginning retry 8 in 1000ms. The process cannot access the file 'bin\Debug\net462\WebApiApplication.exe' because it is being used by another process. The file is locked by: "Microsoft Visual Studio 2017 (9520)"
1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\Microsoft.Common.CurrentVersion.targets(4172,5): warning MSB3026: Could not copy "obj\Debug\net462\WebApiApplication.exe" to "bin\Debug\net462\WebApiApplication.exe". Beginning retry 9 in 1000ms. The process cannot access the file 'bin\Debug\net462\WebApiApplication.exe' because it is being used by another process. The file is locked by: "Microsoft Visual Studio 2017 (9520)"
1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\Microsoft.Common.CurrentVersion.targets(4172,5): warning MSB3026: Could not copy "obj\Debug\net462\WebApiApplication.exe" to "bin\Debug\net462\WebApiApplication.exe". Beginning retry 10 in 1000ms. The process cannot access the file 'bin\Debug\net462\WebApiApplication.exe' because it is being used by another process. The file is locked by: "Microsoft Visual Studio 2017 (9520)"
1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\Microsoft.Common.CurrentVersion.targets(4172,5): error MSB3027: Could not copy "obj\Debug\net462\WebApiApplication.exe" to "bin\Debug\net462\WebApiApplication.exe". Exceeded retry count of 10. Failed. The file is locked by: "Microsoft Visual Studio 2017 (9520)"
1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\Microsoft.Common.CurrentVersion.targets(4172,5): error MSB3021: Unable to copy file "obj\Debug\net462\WebApiApplication.exe" to "bin\Debug\net462\WebApiApplication.exe". The process cannot access the file 'bin\Debug\net462\WebApiApplication.exe' because it is being used by another process.

这是我 Visual Studio 的安装信息:

Microsoft Visual Studio Enterprise 2017 
Version 15.7.1
VisualStudio.15.Release/15.7.1+27703.2000
Microsoft .NET Framework
Version 4.7.02556

Installed Version: Enterprise

Architecture Diagrams and Analysis Tools   00369-60000-00001-AA311
Microsoft Architecture Diagrams and Analysis Tools

Visual C++ 2017   00369-60000-00001-AA311
Microsoft Visual C++ 2017

ActiveReports 11   11.2.10750.0
The first report writer for Microsoft .NET

Application Insights Tools for Visual Studio Package   8.12.10405.1
Application Insights Tools for Visual Studio

ASP.NET and Web Tools 2017   15.0.40501.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 2012   4.0.21208.0
For additional information, visit https://www.asp.net/

ASP.NET Web Frameworks and Tools 2017   5.2.60419.0
For additional information, visit https://www.asp.net/

Azure App Service Tools v3.0.0   15.0.40424.0
Azure App Service Tools v3.0.0

C# Tools   2.8.0-beta6-62830-08. Commit Hash: e595ee276d14e14bfb3eb323fb57f2aa668bddea
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.

JavaScript Language Service   2.0
JavaScript Language Service

JavaScript Project System   2.0
JavaScript Project System

JavaScript UWP Project System   2.0
JavaScript UWP Project System

JetBrains ReSharper Ultimate 2018.1    Build 112.0.20180414.70444
JetBrains ReSharper Ultimate package for Microsoft Visual Studio. For more information about ReSharper Ultimate, visit http://www.jetbrains.com/resharper. Copyright © 2018 JetBrains, Inc.

Merq   1.1.17-rc (cba4571)
Command Bus, Event Stream and Async Manager for Visual Studio extensions.

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 C++ Wizards   1.0
Microsoft Visual C++ Wizards

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.

Microsoft Visual Studio VC Package   1.0
Microsoft Visual Studio VC Package

Mono Debugging for Visual Studio   4.10.5-pre (ab58725)
Support for debugging Mono processes with Visual Studio.

Node.js Tools   1.4.11027.3
Adds support for developing and debugging Node.js apps in Visual Studio

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

Sandcastle Help File Builder   SHFB
Visual Studio integration for the Sandcastle Help File Builder.
https://GitHub.com/EWSoftware/SHFB

Snapshot Debugging Extension   1.0
Snapshot Debugging Visual Studio Extension Detailed Info

SQL Server Data Tools   15.1.61804.210
Microsoft SQL Server Data Tools

SQL Server Reporting Services   14.0.1016.246
Microsoft SQL Server Reporting Services Designers 
Version 14.0.1016.246

Syntax Visualizer   1.0
An extension for visualizing Roslyn SyntaxTrees.

TypeScript Tools   15.7.20419.2003
TypeScript Tools for Microsoft Visual Studio

Visual Basic Tools   2.8.0-beta6-62830-08. Commit Hash: e595ee276d14e14bfb3eb323fb57f2aa668bddea
Visual Basic components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.

Visual F# Tools 10.1 for F# 4.1   15.7.0.0.  Commit Hash: 16ecf5a30ad868d183c58e4a71a71c23d4ed3ba9.
Microsoft Visual F# Tools 10.1 for F# 4.1

Visual Studio Code Debug Adapter Host Package   1.0
Interop layer for hosting Visual Studio Code debug adapters in Visual Studio

Visual Studio Tools for Apache Cordova   15.123.7408.1
Visual Studio Tools for Apache Cordova

Visual Studio Tools for Universal Windows Apps   15.0.27703.01
The Visual Studio Tools for Universal Windows apps allow you to build a single universal app experience that can reach every device running Windows 10: phone, tablet, PC, and more. It includes the Microsoft Windows 10 Software Development Kit.

VisualStudio.Mac   1.0
Mac Extension for Visual Studio

Windows Machine Learning Generator Extension   1.0
Windows Machine Learning Visual Studio Extension Detailed Info

Xamarin   4.10.0.442 (396b18cef)
Visual Studio extension to enable development for Xamarin.iOS and Xamarin.Android.

Xamarin Designer   4.12.264 (fc37cd02e)
Visual Studio extension to enable Xamarin Designer tools in Visual Studio.

Xamarin.Android SDK   8.3.0.19 (HEAD/342b2ce96)
Xamarin.Android Reference Assemblies and MSBuild support.

Xamarin.iOS and Xamarin.Mac SDK   11.10.1.177 (7e782c1)
Xamarin.iOS and Xamarin.Mac Reference Assemblies and MSBuild support.

我已经在网上搜索了很久,但是没有找到任何相关的内容。我甚至向微软提交了一个帮助工单,但他们要求我提供一个能够重现问题的小型项目。由于我无法在我们的专有代码之外重现此问题,因此我无法向他们发送任何内容。但是,我可以补充说,如果从混合中删除.NET 4.6.2项目,则不会发生这种情况。由于这对我们的生产代码来说并不是现实的期望,因此我正在寻找解决问题的方法。
这并不是所有团队成员都会遇到的问题,只有我的电脑会出现这种情况。
以下是我尝试过的方法:
- 删除bin和obj文件夹-在异常后这是不可能的,因为Visual Studio锁定了这些文件。可以在重新启动和调试会话之前删除它们。 - 安装最新的Visual Studio更新(15.7.1) - 在调试期间禁用诊断工具 - 在构建和调试期间禁用实时单元测试
我很迷茫。我该怎么做才能使Visual Studio在异常后继续构建呢?是否有其他人遇到过类似的问题?
谢谢!

如果你在专有代码之外无法复现它,那么问题出在那段代码中。找出问题所在并解决它吧 :-) 但如果你无法向我们展示如何重现该问题,我们是无法做到这点的。 - Ken White
这只发生在你的机器上,还是其他开发者的机器上也会出现? - Ron Beyer
如果这只发生在你的电脑上,请检查框架 -> https://www.microsoft.com/net/download/visual-studio-sdks - Nekeniehl
1
您可以使用解锁工具来在异常后解除被锁定的文件,这样至少您就不必重新启动了。 - Nekeniehl
@RonBeyer 目前只在我的电脑上。 - Michael Earls
显示剩余3条评论
1个回答

1
经过多次尝试修复此问题,我最终决定卸载并重新安装Visual Studio。这解决了该问题。我没有重新安装所有第三方插件(Resharper),因此不确定其中一个是否是原因。
问题已消失。现在我可以在调试会话期间发生异常后重新构建。
感谢所有的评论。

很高兴知道您解决了这个问题,您可以将其标记为答案,以便帮助其他社区成员。祝您有愉快的一天:) - Jack Zhai

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接