visual-studiossissql-server-data-tools

How do I work around the "The process cannot access the file .ISPAC because it is being used by another process" error?


I executed an SSIS package using SSDT and Visual Studio. When I try to execute another package I get an error saying "The process cannot access the file XXXX.ispac because it is being used by another process". I have tried rebooting but that is a pain in the behind. How can I work around this error?

SSIS pop up window:

enter image description here

Microsoft Visual Studio. Exception deserializing the package "The process cannot access the file '...' because it is being used by another process. (mscorlib)

Or another SSIS pop up window that you might also run into if you run a package:

enter image description here

Microsoft Visual Studio. Failed to execute the package or element. Build errors were encountered. For more information, see the Output window.

SSIS Output window:

enter image description here


Solution

  • You might check your patch level. I saw this much more frequently with the 2015 release of SSDT but hasn't bit me too often since then.

    Finding and killing a process

    Sysinternals has an excellent tool called Process Explorer. It's free, doesn't require an install and helps you see what all is happening on your computer. In this case, you want to find the process that has its grubby finger on your file (MyProject.ispac) and then kill it.

    https://helpcenter.gsx.com/hc/en-us/articles/115015880627-How-to-Identify-which-Windows-Process-is-Locking-a-File-or-Folder

    A different approach that doesn't require getting Process Explorer running is to change your build from Development to Release (and back again).

    Chicken Sandwich No Pickles asks via comments

    How can I convert from Development to Release?

    In your tool bar, click where you see Development in the dropdown (or right click the solution in Solution Explorer)

    enter image description here

    In Configuration manager, you may/may not have a listing available under Configuration. Earlier versions of SSIS projects had dev/release configurations predefined but it looks like newer ones do not. If you do not have another option, make one via <New...>

    enter image description here

    Copy the values from the Development configuration et voilĂ !

    enter image description here

    Now when you debug, ProjectFolder/bin/Release will exist and the dtsdebughost.exe will latch onto that file and release the pointers to ProjectFolder/bin/Development/Project.ispac