Emulating Visual Studio's Web Application "publish" at the command line
- by cbp
Hi,
I am trying to automate my deployment process and am now thoroughly confused. I know that there are many questions on stackoverflow about this, but they all have different solutions and none of them work.
I have a Web Application project which I usually publish by right-clicking and selecting "Publish". I get a dialog box where I use the following options:
Build configuration: Release
Publish method: File system
Target location: C:\Deployments\MyWebsite
Replace matching files with local copies
I should mention that in the properties of the project I have "Items to deploy" set to "Only files needed to run this application".
After running this, my entire solution is built, dependencies are resolved, build events are run, web.config transformations are applied and the website is copied to C:\Deployments\MyWebsite, although non-required files such as code-behind files are not copied.
I have not been able to replicate this... in fact at this stage I'm not even sure which command line tool am I supposed to be using - msbuild, msdeploy or aspnet_compiler?
This guy asks almost the same question but his solution doesn't work at all. For example, build events do not run correctly because the macros are not resolved. Whats more, the files do not get copied into the correct directory at all... I can't even begin to explain what happens!