I am trying to create a PowerShell v5 script to build and publish a VS2017 WCF Web Service Application (.NET Framework 4) so that I can automate it in Bamboo. I have the msbuild command working that does the build correctly and now I need to publish the project to a folder using a FolderProfile.
I can do it manually with success by right-clicking on the project and selecting publish, then selecting the FolderProfile. This puts the files that need to be deployed to the website in the project's bin\Release\PublishOutput location. I want to automate that publishaction in a Powershell script.
I have tried the recommendation on Sayed Hashimi's site, which is similar to below (I just use VS2017 version of 15.2, and, of course, replace the project name and profile with my actual values);
msbuild MyProject.csproj /p:DeployOnBuild=true /p:PublishProfile=<profile-name> /p:Password=<insert-password> /p:VisualStudioVersion=15.2
But this did not put any files in the bin\Release\PublishOutput
location. It looked like it just did a standard build.
EDIT:
msbuild lists this line in the output when I run the above command;
DeploymentUnpublishable:
Skipping unpublishable project.
I have looked through this post on GitHub and some have cited a solution as updating to v15.2 of VS2017, which I have already done;
Microsoft Visual Studio Enterprise 2017
Version 15.2 (26430.16) Release
Any Ideas?
EDIT - Solution
@Leo-MSFT provided this solution...
msbuild myproject\myproject.vbproj /p:DeployOnBuild=true /p:PublishProfile=FolderProfile.pubxml /p:Configuration=Release
This put the files into bin\release\PublishOutput.
I had spent several days searching for this solution and I had added various command parameters suggested in other SO and GitHub forum posts, such as /t:Publish
, /p:PublishProfileRootFolder
and /p:VisualStudioVersion=15.2
. I removed those and just used the line above which finally created the published output I needed.