简体   繁体   English

MSDeploy无法删除文件

[英]MSDeploy not able to delete files

I've got a TFS build set up to build and deploy a web application. 我已经建立了一个TFS构建来构建和部署Web应用程序。 I'm passing in the MSDeploy parameters via the TFS build definition's MSBuild arguments. 我通过TFS构建定义的MSBuild参数传递MSDeploy参数。 First time round this is working fine. 第一次,这很好。 When someone accesses the web app, one of the controls (Microsoft charting control) generates a couple of files in an empty directory I've added to the solution. 当某人访问Web应用程序时,其中一个控件(Microsoft图表控件)会在我已添加到解决方案的空目录中生成几个文件。

When I go to rebuild (or continuous integration is triggered) the next build will usually fail because it can't delete one of the generated files. 当我进行重建(或触发连续集成)时,下一个构建通常会失败,因为它无法删除其中一个生成的文件。 When I try and manually delete the file it tells me that IIS worker process is using it and it can't be deleted. 当我尝试手动删除文件时,它告诉我IIS工作进程正在使用它,无法删除它。

Now to get the build building I'd have to manually restart IIS every time, which is not desirable with CI in mind. 现在要建立构建,我必须每次都手动重新启动IIS,考虑到CI,这是不希望的。 I've taken a look through Microsoft.Web.Publishing.Tasks.dll and there's nothing there to restart IIS using MSDeploy. 我已经浏览了Microsoft.Web.Publishing.Tasks.dll,那里没有使用MSDeploy重新启动IIS的功能。

At the moment I'm thinking that adding stubs of the temporary files in the solution might be a resolution (maybe MSDeploy will be able to close the process if the file is a permanent part of the deployment) or I could do some unpleasantness with Exec in the solution file to get an IIS reset. 目前,我正在考虑在解决方案中添加临时文件的存根可能是一种解决方案(如果文件是部署的永久组成部分,则MSDeploy将能够关闭该进程),或者我可以对Exec进行一些令人不快的操作在解决方案文件中获取IIS重置。

It's probably a long shot but has anyone come up against this and found a nice solution? 这可能是一个很长的路要走,但是有谁遇到这个问题并找到了一个不错的解决方案?

You could use MSBuild Extension Pack to stop the application pool automatically before deployment. 您可以使用MSBuild Extension Pack在部署之前自动停止应用程序池。 There are several tasks in the MSBuild.ExtensionPack.Web namespace to manage IIS, such as stopping and starting an application pool, deleting an application, etc. MSBuild.ExtensionPack.Web命名空间中有多项任务来管理IIS,例如停止和启动应用程序池,删除应用程序等。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM