Visual Studio 2017 调试期间出现异常后需要重启
Visual Studio 2017 requires restart after exception during debug
我在 Visual Studio 2017(版本 15.7.1)中遇到了一个奇怪的问题。 Visual Studio 在调试会话期间发生异常后构建失败。这是在使用 net462 的 WebApi 项目中发生的。正在使用的库之一是在 .NET 4.6.2 中构建的自定义库,它使用 Entity Framework 6、Automapper 和 LinqKit。
出现异常后,如果我尝试构建,会出现以下构建错误,我必须重新启动 Visual Studio 才能成功构建:
1>Build FAILED.
1>
1>C:\Program Files (x86)\Microsoft Visual Studio17\Enterprise\MSBuild.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 Studio17\Enterprise\MSBuild.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 Studio17\Enterprise\MSBuild.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 Studio17\Enterprise\MSBuild.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 Studio17\Enterprise\MSBuild.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 Studio17\Enterprise\MSBuild.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 Studio17\Enterprise\MSBuild.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 Studio17\Enterprise\MSBuild.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 Studio17\Enterprise\MSBuild.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 Studio17\Enterprise\MSBuild.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 Studio17\Enterprise\MSBuild.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 Studio17\Enterprise\MSBuild.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 Studio17\Enterprise\MSBuild.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 Studio17\Enterprise\MSBuild.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 Studio17\Enterprise\MSBuild.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 Studio17\Enterprise\MSBuild.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 Studio17\Enterprise\MSBuild.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 Studio17\Enterprise\MSBuild.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 Studio17\Enterprise\MSBuild.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 Studio17\Enterprise\MSBuild.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 Studio17\Enterprise\MSBuild.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 Studio17\Enterprise\MSBuild.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 Studio17\Enterprise\MSBuild.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 Studio17\Enterprise\MSBuild.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 Studio17\Enterprise\MSBuild.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 Studio17\Enterprise\MSBuild.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 Studio17\Enterprise\MSBuild.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 Studio17\Enterprise\MSBuild.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 Studio17\Enterprise\MSBuild.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 Studio17\Enterprise\MSBuild.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 Studio17\Enterprise\MSBuild.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 Studio17\Enterprise\MSBuild.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 Studio17\Enterprise\MSBuild.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 Studio17\Enterprise\MSBuild.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 Studio17\Enterprise\MSBuild.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 Studio17\Enterprise\MSBuild.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 Studio17\Enterprise\MSBuild.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 Studio17\Enterprise\MSBuild.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 Studio17\Enterprise\MSBuild.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 Studio17\Enterprise\MSBuild.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 Studio17\Enterprise\MSBuild.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 Studio17\Enterprise\MSBuild.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 Studio17\Enterprise\MSBuild.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 Studio17\Enterprise\MSBuild.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 Studio17\Enterprise\MSBuild.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 Studio17\Enterprise\MSBuild.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 Studio17\Enterprise\MSBuild.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 Studio17\Enterprise\MSBuild.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 Studio17\Enterprise\MSBuild.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 Studio17\Enterprise\MSBuild.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 Studio17\Enterprise\MSBuild.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 Studio17\Enterprise\MSBuild.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 Studio17\Enterprise\MSBuild.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 恢复构建?还有其他人看到过类似的行为吗?
谢谢
经过多次尝试解决此问题后,我最终决定卸载并重新安装 Visual Studio。这解决了这个问题。我没有重新安装所有第三方插件 (Resharper),所以我不确定是否是其中一个原因。
问题消失了。我现在可以在调试会话期间出现异常后重建。
感谢大家的评论。
我在 Visual Studio 2017(版本 15.7.1)中遇到了一个奇怪的问题。 Visual Studio 在调试会话期间发生异常后构建失败。这是在使用 net462 的 WebApi 项目中发生的。正在使用的库之一是在 .NET 4.6.2 中构建的自定义库,它使用 Entity Framework 6、Automapper 和 LinqKit。
出现异常后,如果我尝试构建,会出现以下构建错误,我必须重新启动 Visual Studio 才能成功构建:
1>Build FAILED.
1>
1>C:\Program Files (x86)\Microsoft Visual Studio17\Enterprise\MSBuild.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 Studio17\Enterprise\MSBuild.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 Studio17\Enterprise\MSBuild.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 Studio17\Enterprise\MSBuild.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 Studio17\Enterprise\MSBuild.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 Studio17\Enterprise\MSBuild.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 Studio17\Enterprise\MSBuild.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 Studio17\Enterprise\MSBuild.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 Studio17\Enterprise\MSBuild.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 Studio17\Enterprise\MSBuild.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 Studio17\Enterprise\MSBuild.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 Studio17\Enterprise\MSBuild.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 Studio17\Enterprise\MSBuild.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 Studio17\Enterprise\MSBuild.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 Studio17\Enterprise\MSBuild.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 Studio17\Enterprise\MSBuild.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 Studio17\Enterprise\MSBuild.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 Studio17\Enterprise\MSBuild.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 Studio17\Enterprise\MSBuild.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 Studio17\Enterprise\MSBuild.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 Studio17\Enterprise\MSBuild.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 Studio17\Enterprise\MSBuild.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 Studio17\Enterprise\MSBuild.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 Studio17\Enterprise\MSBuild.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 Studio17\Enterprise\MSBuild.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 Studio17\Enterprise\MSBuild.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 Studio17\Enterprise\MSBuild.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 Studio17\Enterprise\MSBuild.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 Studio17\Enterprise\MSBuild.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 Studio17\Enterprise\MSBuild.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 Studio17\Enterprise\MSBuild.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 Studio17\Enterprise\MSBuild.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 Studio17\Enterprise\MSBuild.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 Studio17\Enterprise\MSBuild.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 Studio17\Enterprise\MSBuild.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 Studio17\Enterprise\MSBuild.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 Studio17\Enterprise\MSBuild.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 Studio17\Enterprise\MSBuild.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 Studio17\Enterprise\MSBuild.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 Studio17\Enterprise\MSBuild.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 Studio17\Enterprise\MSBuild.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 Studio17\Enterprise\MSBuild.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 Studio17\Enterprise\MSBuild.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 Studio17\Enterprise\MSBuild.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 Studio17\Enterprise\MSBuild.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 Studio17\Enterprise\MSBuild.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 Studio17\Enterprise\MSBuild.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 Studio17\Enterprise\MSBuild.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 Studio17\Enterprise\MSBuild.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 Studio17\Enterprise\MSBuild.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 Studio17\Enterprise\MSBuild.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 Studio17\Enterprise\MSBuild.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 Studio17\Enterprise\MSBuild.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 恢复构建?还有其他人看到过类似的行为吗?
谢谢
经过多次尝试解决此问题后,我最终决定卸载并重新安装 Visual Studio。这解决了这个问题。我没有重新安装所有第三方插件 (Resharper),所以我不确定是否是其中一个原因。
问题消失了。我现在可以在调试会话期间出现异常后重建。
感谢大家的评论。