The process cannot access the file issue during local deployment

Topics: Visual Studio Integration
Oct 25, 2013 at 7:36 PM
Hi,
We are using BizTalk deployment framework 5.0. When we use the "Build Sserver Deploy MSI" option, we are able to generate the MSI file successfully. However, when we deploy to local machine using "Deploy BizTalk Solution" we get the following error. We have uninstall the BizTalk deployment framework and install it back too.

Error: Failed to add resource (Luid="System.BizTalk:BizTalkAssembly", Type="Exchange.Services, Version=1.0.0.0, Culture=neutral, PublicKeyToken=244160366b5f9e8a").
The process cannot access the file 'C:\Users\asathia\AppData\Local\Temp\BT\PID12132\lqkbptht.cab' because it is being used by another process.
Command failed with 1 errors, 0 warnings.

Can anyone please guide to rectify this error? This issue is completely halting our development activities. Thanks in advance.
Coordinator
Oct 25, 2013 at 8:41 PM
Hi, that error has nothing to do with the Deployment Framework. BizTalk's BTSTASK.EXE is throwing that exception. If rebooting doesn't help, go to C:\Users\asathia\AppData\Local\Temp and delete the entire BT subfolder.

Thanks,
Tom
Oct 25, 2013 at 8:50 PM
We tried re-booting the machine many times and we see the same behaviour. Furhther, the foler "C:\Users\asathia\AppData\Local\Temp" doesn't have the sub folder BT once the Visual Studio stop deploying the application. It seems that the deployment framework creates the folder "BT" at run time and delete it at the end of the deploy process regardless of success or failure status.
Coordinator
Oct 25, 2013 at 10:10 PM
The only thing that is very suspicious is the temp filename lqkbptht.cab. When deploying with the Deployment Framework for BizTalk, you will never use .cab files, however the out-of-the-box BizTalk MSI deployment DOES use .cab files. Have you completely removed this application from BizTalk?

Are you still doing anything with the out-of-the-box BizTalk deployment tools? You should no longer use the Deploy option found on the BizTalk projects, nor the MSI Import/Export in BizTalk Admin.

The normal output looks like:
Information: Deploy server="BTS1" database="BizTalkMgmtDb" assembly="C:\Users\tabraham\AppData\Local\Temp\BT\PID3128\BizTalkAssembly\f48cae45a93abbf44c949d1296ce27d5\ABC.Transforms.dll"

It should always be .dll, not a .cab file.

Tom
Oct 25, 2013 at 11:55 PM
Edited Oct 26, 2013 at 12:00 AM
We are not using any of the out-of-the-box BizTalk MSI deployment. We deploy everything using Deployment Framework 5.0 which was downloaded 2010 in our office. Yes...We completely removed the application and tried to re-install it again. We use deployment framework option to deploy in the local servers as well as on all the environments(DEV, QA and PROD)
 By the way, the scripts are running good for three years without any issues and recently we installed BizTalk server 2009 CU6 and Adapter pack 2.0 CU5 and SQL Server 2008 SP3. We started seeing this issue only after these hot fix are installed. 
Coordinator
Oct 28, 2013 at 7:08 AM
I'm not sure what to narrow in on other than the .CAB filename, because I don't know why it would be using a .CAB file to deploy an assembly. I verified on a BTS 2010 deploy that during deploy of a BizTalk DLL it does show the path as .DLL. I even changed the permissions of that BT temp dir so that BTSTASK could not write to it, and the error message made sense saying access denied, so that did not show anything useful.

Also, please copy the failing BTSTASK.exe command line out of the Output window and paste and run it manually in a Command Prompt. See what happens.

Do you have a DeployResults.txt from prior deployments where you can compare that same deploy step output to the current one?

Tom
Oct 28, 2013 at 11:04 PM
I don't have any prior deployment resutls on my machine. I used BTSTask.exe on the command prompt as you mentioned and it deployed the DLL without any issues...I have checked the permissions on the "Temp" folder and I am the owner and I have full rights on it. Here is teh Target which gives this error,

<Target Name="DeploySchemas-LeadServices" DependsOnTargets="UndeploySchemas" Condition="'$(IncludeSchemas-LeadServices)' == 'true'">
<!-- Deploy schema assemblies. -->

<ItemGroupFromSeparatedList SeparatedList="$(Schemas-LeadServices)" FormatString="$(FullPathFormatString)" ReverseList="false">
  <Output TaskParameter="ItemGroup" ItemName="DeploySchemasGroup-LeadServices" />
</ItemGroupFromSeparatedList>

<Exec
      Command="BTSTask.exe AddResource -Type:BizTalkAssembly -Source:&quot;@(DeploySchemasGroup-LeadServices)&quot; -ApplicationName:$(BizTalkAppName-LeadCommon) -Options:GacOnAdd,GacOnImport,GacOnInstall"
      Condition="%(Identity) == %(Identity) and '$(DeployBizTalkMgmtDB)' == 'true'" />

<Exec Command="&quot;$(Gacutil)&quot; /i &quot;@(DeploySchemasGroup-LeadServices)&quot;"
          Condition="%(Identity) == %(Identity) and '$(DeployBizTalkMgmtDB)' == 'false'" />
</Target>
Oct 30, 2013 at 3:48 PM
Just an update. We have setup a new machine and ran the same deployment project and it deploys the projects without any issues. This issue is happening in only one machine. We have tried to un-install and re-install biztalk and deployment framework as well. However, we see the same behaviour on this machine. Do you have any suggestions in this situation? Thanks.
Coordinator
Oct 30, 2013 at 11:11 PM
If it were me and a lot of time has gone into it already, and it's isolated to one machine, I'd probably just rebuild the machine. You could chase it for a long time. At this point you've eliminated issues with the software and it's down to some configuration issue on that machine.

The only thing I had noticed from what you provided is the .cab vs. .dll oddity in the log. On the other machine that works, does it show the file path in that btstask.exe step as .dll or .cab? Then look at the same output on the machine that doesn't work and compare the two.

Thanks,
Tom
Nov 4, 2013 at 2:54 PM
I have compared the log files between my new machine and the old machine. I am not seeing that its logging anything related to ".cab" file. Its really strange how two machines are behaving with the same scripts. Anyway, it seems the issue is very much related to only one machine which we used for the last three years. I am closing this thread now. Thanks for your help Tom.
Marked as answer by galaxyraja on 11/4/2013 at 7:54 AM
Feb 7, 2014 at 9:44 AM
I have the same issue now. We have our BTDF Solutions for years and it suddenly started. Unfortunately, it occurs on two machines, so I doubt rebuilding my development environment will help. Interesting enough, a Rebuild All before I deploy sometimes helps. And sometimes it gives an error on a different CAB file.
Coordinator
Feb 13, 2014 at 4:58 AM
What has changed recently on the machines? Have any changes occurred to BizTalk or the Deployment Framework when this started happening? When it occurs you can see if you have multiple MSBuild.exe or BTSTask.exe's running in Task Manager.

Thanks,
Tom
Feb 17, 2014 at 1:47 PM
  • To my knowledge, nothing has changed.
  • No changes to BizTalk or the Deployment Framework
  • I checked, when this occurs I can see only one instance of MSBuild.exe and one BTSTask.exe
Feb 21, 2014 at 11:19 AM
We fixed it. We asked our infra guys to put a virus scan exclusion on those locations, and the problem disappeared. We still have no idea why this problem suddenly started occurring, since we aren't aware of any changes that might have triggered this.

But at least we have a solution. I am glad, since this problem also occurred on our test environments, which made our full deployments impossible without errors.
Coordinator
Feb 21, 2014 at 3:14 PM
Glad to hear it. That makes sense -- some virus scanners are notorious for causing problems like that, but most places it's nearly impossible to get any folders excluded from the scan.

Thanks for the update!
Tom