Reputation: 2523
There is a Visual Studio solution that has multiple web application projects. All of them are to be published to a common folder - D:\inetpub\wwwroot\FirstSite
.
Each project has a publish profile Local.pubxml
which imports settings from a global publishsettings.xml
, and I use the One-Click Publish
feature to publish each project.
Now, I would like to automate this process, which will Rebuild the solution and on success, publish all the projects to the target folder.
I have managed to create a Console application using C#, which can build all the projects in a solution. But, unfortunately could only go that far, as I'm unable to figure out how to get started about the publishing.
I'm not looking for setting up a build server. Just want to save time publishing projects to local folders.
Can we achieve this in a console application, by passing parameters like 'solution path' & 'target folder path', so that it can work for any such solution with multiple projects.
If not, are there any simple tools for this.
Upvotes: 3
Views: 581
Reputation: 1776
When you invoke msbuild for the solution build, you can pass
/p:DeployOnBuild=true /p:PublishProfile=Local /p:SkipInvalidConfigurations=true
which will publish each project with the Local
profile for you
Upvotes: 2