Visual Studio – Error – System.IO.IOException – The process cannot access the file ispac because it is being used by another process

Background

Occasionally, I run into an error when trying to build a project in Visual Studio.

 

Error

Sample Error

Images

Image – Build Errors.  Run the last successful build?

Textual


There were build errors.  Would you like to continue and run the last successful build?

Image – Process cannot access the file because it is being used by another process

 

Textual


Severity Code Description Project File Line Suppression State
Error System.IO.IOException: The process cannot access the file 'sample.ispac' because it is being used by another process.
at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
at System.IO.File.InternalDelete(String path, Boolean checkHost)
at System.IO.File.Delete(String path)
at Microsoft.DataTransformationServices.Project.DataTransformationsProjectBuilder.IncrementalBuildThroughObj(IOutputWindow outputWindow)
at Microsoft.DataTransformationServices.Project.DataTransformationsProjectBuilder.BuildIncremental(IOutputWindow outputWindow) 0
Error System.IO.IOException: The process cannot access the file 'sample.ispac' because it is being used by another process.
at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
at System.IO.File.InternalDelete(String path, Boolean checkHost)
at System.IO.File.Delete(String path)
at Microsoft.DataTransformationServices.Project.DataTransformationsProjectBuilder.IncrementalBuildThroughObj(IOutputWindow outputWindow)
at Microsoft.DataTransformationServices.Project.DataTransformationsProjectBuilder.BuildIncremental(IOutputWindow outputWindow) 0
Error System.IO.IOException: The process cannot access the file 'sample.ispac' because it is being used by another process.
at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
at System.IO.File.InternalDelete(String path, Boolean checkHost)
at System.IO.File.Delete(String path)

 

TroubleShooting

Outline

  1. File Write Lock Process Identification

Task – File Write Lock Process Identification

Tools

Let us quickly review some of the tools for identifying processes holding a write lock on a file.

  1. SysInternals
    • handle

SysInternals

Handle

Availability

The handle process is available here.

Install

No need to install, it is an executable ( exe ).

We just launch a command shell and run it.

Help

To get help, please issue “handle.exe /?“.

Argument Detail
Name
  1. This parameter is present so that you can direct Handle to search for references to an object with a particular name.
  2. For example, if you wanted to know which process (if any) has “c:\windows\system32” open you could type: handle windows\system
  3. The name match is case-insensitive and the fragment specified can be anywhere in the paths you are interested in.
-nobanner Do not display the startup banner and copyright message
Run
Syntax

handle [name]

Sample
  1. To find references matching our culprit, we can supply the file’s full name or any part of the file name.
  2. For the sake of simplicity and also knowing that our file extension is not so common, we will simply supply the file’s extension ( ispac ).

 


handle ispac

Output – Image

Output – Text

handle ispac

Nthandle v4.22 - Handle viewer
Copyright (C) 1997-2019 Mark Russinovich
Sysinternals - www.sysinternals.com

DTExec.exe         pid: 21220  type: File            78: sample.ispac

Explanation
  1. Matches
    • Application Name:- DTEexec.exe
    • Process ID:- 21220
    • Type:- File
    • File Name:- sample.ispac

 

Remediation

Outline

  1. Review running processes

Task – Review Running Processes

Our matched process is dtexec.exe

DTexec.exe is a hosting container for SSIS and DTS Packages.

Images

Image – Previous Execution

Text

Traced the blocking process back to a previous same application project run.

Accessed the previous shell and did as told: “Press any key to continue …. “.

 

Dedication

Dedicating: to my spouse.

She and the computer know all my foibles.

 

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s