简体   繁体   中英

MSBuild from command line, but no app_offline.htm?

I have an MVC Application and a WebAPI Service is a single solution, and for both projects I have created a publilsh profile using the File System to deploy. It actually works quite beautifully. However, I have to manually deploy each project first to Staging, then to Production. It's tedious to say the least.

I've figured out how I can call MSBuild via the command line, and specify the publish profile. This allows me to call MSBuild at a solution level, and the MVC app and the Service both get deployed. Great. However...

When I call the publish function via VS2015 (right click on project, select Publish, choose the right profile, and away it goes) it copies an app_offline.htm, deletes what is currently there, builds the project and deploys. But when I do this via the command line, the app_offline.htm never shows up, it doesn't delete the files first before deploying.

Is there some switch or parameter I am missing in my MSbuild command line, which quite frankly is pretty simply:

msbuild .\mySolution.sln /p:DeployOnBuild=true /p:PublishProfile=Staging

I know Web Deploy is the preferred method, but we're a bit backwards here, we never truly adopt the latest and greatest, so I need to figure out how I can conitnue using my current publish profiles, using the File System, just a bit more efficient than publishing each project individually, multiple times.

For the most part VS and MSBuild via the command line do essentially the same thing. But I have experience similar issues to what you are running into. One way to deal with this is to create a target to make sure that your files are copied appropriately. This MSDN Question goes into more detail on a few solutions that may help. In several instances, I have powershell scripts or batch files that are checked into the projects in question and I run them on the target machines once the solution is deployed.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM