3
votes

I am attempting to use Hangfire. Here's my problem, when i try to publish to azure the publish fails coz the DLL is being used by another process.

VSMSDeploy] C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\Web\Microsoft.Web.Publishing.targets(4276, 5): error ERROR_FILE_IN_USE: Web deployment task failed. (Web Deploy cannot modify the file 'Takenet.WebApi.dll' on the destination because it is locked by an external process. In order to allow the publish operation to succeed, you may need to either restart your application to release the lock, or use the AppOffline rule handler for .Net applications on your next publish attempt. Learn more at: http://go.microsoft.com/fwlink/?LinkId=221672#ERROR_FILE_IN_USE.)

I've used the AppOffline rule which add App_Offline.htm in the root of my webapp. Once the file is there, IIS will takedown the worker process for my app and unload any files in use but the publish still fails looks like the publish is going faster then the shutdown =/

Can anyone help?

1

1 Answers

6
votes

first i added the AppOffline rule in the PublishProfile, but looks like this rule is only used if you deploy using Visual Studio =/ so i had to make this rule be applied into the team city.

Set these properties on the command line/build server

When you invoke msbuild.exe you can pass this property in as you would any other MSBuild property. Use the following syntax,

/p:EnableMSDeployAppOffline=true /p:MSDeployUseChecksum=true