Octopus deploy not deleting files not being referenced in the project

Hello - We are testing out teamcity and octopus deploy for our MVC app. We have setup an initial deployment and everything works fine (from teamcity to Octopus). I have noticed one problem , eg: if we remove references for files or a folder in the mvc app, when the deployment is completed , these files are not being deleted from the iis folder eventhough these files are no longer in the artifacts output. how can I accomplish this?

Hi Neeraj,

Thanks for getting in touch! Sorry for the delay in getting back to you here.
So just a quick question. Are the files that you are expecting to see deleted part of your package when it’d deployed?

Thanks!
Vanessa

No. As part of the package these are not present (which is correct), but when I deploy it against the IIS, the files do not get deleted which they should.

Eg: If we delete a EmployeePast.html from our csproj file, the nuget package does not contain this file, but after the build - EmployeePast.html is not getting deleted from the IIS folder. Does it make sense?

is there a setting or something that I am missing here?

Hi Neeraj,

Are you using the custom installation directory? That has a purge files option that will clean out the directory before moving the files in, thus getting rid of any files you no longer want.

Let me know if this resolves the issue!
Vanessa

Vanessa - Thanks, that solved the problem.

I have one concern - won’t all the files here be changed in my target website and in turn force clients to download all the files because of timestamp being changed.
This will cause concerns for caching on client side. Our clients will have to take a hit the first time irrespective of any minor patch or a major build we do. How do we prevent this situation?

Hi Neeraj,

If your caching system is based off timestamps then yes this will cause the issue you described. However many people using a file hash caching system instead which will only pick up changed files.

Hope this helps!
Vanessa