Abe Miessler
Abe Miessler

Reputation: 85036

Prevent overwriting of a file when deploying?

NOTE: This is for a Visual Studio Web Site Project and NOT a Web Application

I am using web deploy to push changes from my development machine to my staging server. I would like to push any files that are different to the staging server except for one particular file (lets call it myFile.whatever)

So far I have tried editing the C:\Program Files\IIS\Microsoft Web Deploy V3\msdeploy.exe.config file to look like so:

<configuration>
  <startup>
    <supportedRuntime version="v2.0.50727" />
    <supportedRuntime version="v4.0" />
  </startup>
  <rules> <------------ ADDED THIS NODE
    <rule name="skipConfig" type="Microsoft.Web.Deployment.DeploymentSkipRuleHandler"
          objectName="filePath" skipAction="Delete" 
          absolutePath="C:\inetpub\wwwroot\MyProject\myFile.whatever"/>
  </rules>
</configuration>

But it is still overwriting the file in question on my staging server. I started by editing the msdeploy.exe.config on my dev machine and when that didn't work I updated the msdeploy.exe.config on my staging server as well, but again, still not working.

Am I going about this wrong? Any suggestions on preventing this file from being overwritten?

Upvotes: 0

Views: 1859

Answers (2)

Nathan Prather
Nathan Prather

Reputation: 2106

Since transforms are painful with web site projects you might be able to use this method: http://blogs.msdn.com/b/webdev/archive/2010/04/22/web-deployment-excluding-files-and-folders-via-the-web-application-s-project-file.aspx

Upvotes: 1

Andre Pena
Andre Pena

Reputation: 59336

As stated in the comments, what you would normally do is to have a base Web.config file, then one specific for debug and one specific for release. The debug or release portion would add/override the base one with things that are particular to this scenario. This way you can just upload both and everything will work fine.

To understand more about web.config transformation, please refer to: http://msdn.microsoft.com/en-us/library/dd465326(v=vs.110).aspx

Upvotes: 0

Related Questions