How to automate a Visual Studio 2017 web project to a folder

I'm 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 a msbuild command that works correctly and now I need to publish the project to a folder using FolderProfile.

I can do it manually with success by right clicking on the project and selecting publish and then selecting FolderProfile. This places the files to be deployed to the website in the bin \ Release \ PublishOutput location of the project. I want to automate this posting in a Powershell script.

I tried the recommendation on Syed Hasimi's site , which is similar to below (I'm just using VS2017 version 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 that didn't put any files in the location bin\Release\PublishOutput

. It looks like it's just a standard build.

EDIT:

msbuild translates this line into output when I run the above command;

DeploymentUnpublishable:
    Skipping unpublishable project.

      

I have looked at this post on GitHub and some have cited the solution as an upgrade to v15.2 VS2017 which I already have 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 puts the files in bin \ release \ PublishOutput.

I spent a few days looking for this solution and I added various command options suggested in other SO and GitHub forum posts such as /t:Publish

, /p:PublishProfileRootFolder

and /p:VisualStudioVersion=15.2

. I removed them and just used the line above which finally the posted output I needed was generated.

+3


source to share


1 answer


this did not put files in bin \ Release \ PublishOutput folder. It looks like he just did a standard build

I reproduced this issue using your command line. After researching this issue for a long time, I am trying to remove the " /p:VisualStudioVersion=15.2

" option and then republish the project using the command line:

msbuild MyProject.csproj /p:DeployOnBuild=true /p:PublishProfile="MyProfile.pubxml"

      



It builds and publishes successfully and the web project is published to the folder where you set in the " <publishUrl>

" option in MyProfile.pubxml.

So, try removing the "/ p: VisualStudioVersion " option in the MSBuild command line, check if it works for you.

Note. I also checked this command line with VisualStudioVersion for a project created by Visual Studio 2015, it works fine. Not sure if this is a problem for Visual Studio 2017, I need to confirm it, if this is a problem for Visual Studio 2017, I will submit this problem to the Visual Studio team.

+3


source







All Articles