I'm using this command to build and deploy m开发者_如何学编程y 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?
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.
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
精彩评论