0

I'm using this command to build and deploy my site:

MSBuild myprj.sln 
  /P:Configuration=Debug 
  /P:DeployOnBuild=True 
  /P:MsDeployServiceUrl=http://myserver/MsDeployAgentService
  /P:MSDeployPublishMethod=RemoteAgent 
  /P:DeployTarget=MSDeployPublish 
  /P:UserName=foo 
  /P:Password=bar 
  /P:DeployIisAppPath="Default Web Site\MyApp" 

It works great, except I think I want to exclude a certain data file, say, ~/App_Data/data.xml. I don't want data.xml in my project since it's generated by the app or setup by the user (e.g. by renaming and configuring data.xml.orig to data.xml).

So what to do? Can I simply exclude it from MSDeploy or should I be handling this another way?

Michael Haren
  • 105,752
  • 40
  • 168
  • 205

2 Answers2

0

If I got you right, you should add /p:SkipExtraFilesOnServer=True to your command line. This would leave all extra files on destination, which could be a flaw in some scenarios

If you want to skip only some folders (which could be required, if you do not want to garbage your server a lot, while still keeping some folders intact) - you could use solution from this question: MSDeploy skip rules when using MSBuild PublishProfile with Visual Studio 2012

Community
  • 1
  • 1
Anton Kuryan
  • 607
  • 6
  • 20
0

The files that get published are the build outputs from your project; this includes your DLL and any files with Build Action set to Content. If you set the Build Action to None (click the file in VS, view it's properties), it should get excluded automatically.

If you want to exclude the contents of the App_Data folder entirely, there's an option in the project properties, on the Package/Publish Web tab.

Jimmy
  • 27,142
  • 5
  • 87
  • 100
  • thanks for the tips! Unfortunately, both of those options actually **delete** the files from the destination, since they aren't included in the deployment. – Michael Haren Sep 20 '11 at 13:48
  • There is another option in the publish dialog labeled "Leave extra files at destination", which will stop deleting the files that are already there. – Jimmy Sep 20 '11 at 15:06
  • that option doesn't exist for me. It looks like I ought to switch to doing a regular msdeploy (with a config file for it) instead of passing in my options... – Michael Haren Sep 21 '11 at 14:56