Michael Earls
Michael Earls

Reputation: 1557

Visual Studio 2017 requires restart after exception during debug

I have a strange problem in Visual Studio 2017 (version 15.7.1). Visual Studio fails to build after an exception occurs during a debug session. This is happening in a WebApi project that uses net462. One of the libraries in use is a custom library built in .NET 4.6.2 that uses Entity Framework 6, Automapper, and LinqKit.

After an exception, if I attempt to build, I get the following build errors and I have to restart Visual Studio to get a successful build:

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.

Here is the installation information for my 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.

I've searched the web, but I can't find anything even remotely related. I even opened a help ticket with Microsoft, but they wanted me to give them a small project that has the problem reproduced. I was unable to reproduce the issue outside of our proprietary code, so I couldn't send them anything. However, I can add that if I remove the .NET 4.6.2 project from the mix, this does not happen. Since this is not a realistic expectation for our production code, I'm looking for a solution to the problem.

It's not happening for everyone on my team, only on my computer.

Here is what I have tried:

I'm at a loss. What can I do to get Visual Studio back to building after an exception? Has anyone else seen similar behavior?

Thanks

Upvotes: 3

Views: 1054

Answers (1)

Michael Earls
Michael Earls

Reputation: 1557

After many attempts at fixing this issue, I eventually decided to uninstall and reinstall Visual Studio. This fixed the issue. I did not reinstall all of the third-party plugins (Resharper), so I'm not sure if one of those was the cause.

The problem went away. I can now rebuild after an exception during a debugging session.

Thanks for all of the comments.

Upvotes: 1

Related Questions