0

I want to build a web app (web api 2) in Azure but i don't want to obtain a zip, i just want to get a directory with all necessary files. I don't know the command line to do that. I don't want to use the classical deploy web app task because i need to add additional files after the build. Thanks in advance for your help.

3
  • Just checking in to see if the information provided was helpful. Please let us know if you would like further assistance. Commented Nov 15, 2019 at 1:43
  • 1
    Hi Leo, thank you so much for your answer. I was stucked but you helped me a lot with : /p:SkipInvalidConfigurations=true /p:DeployOnBuild=true /p:WebPublishMethod=FileSystem /p:publishUrl="$(build.artifactstagingdirectory)\\" /p:DeployDefaultTarget=WebPublish Commented Nov 18, 2019 at 18:26
  • Everything is perfect. I've just missed to validate your answer. Sorry for that. Commented Nov 19, 2019 at 8:57

1 Answer 1

1

How to build a web app MVC5-WEB API 2 in Azure Devops with CLI?

You could use Visual Studio Build task with MSBuild Arguments:

/p:SkipInvalidConfigurations=true /p:DeployOnBuild=true /p:WebPublishMethod=FileSystem /p:publishUrl="$(build.artifactstagingdirectory)\\" /p:DeployDefaultTarget=WebPublish 

to publish web app to artifact folder or any other folder you want.

You also can specify the publish profile directly:

/p:SkipInvalidConfigurations=true /p:DeployOnBuild=true /p:PublishProfile="{publish profile name}";publishUrl="$(build.artifactstagingdirectory)"

With FileSystem publish method, the published files are in a folder, not zipped.

And if you want use the command line task instead of Visual Studio Build task, you could invoke MSBuild.exe with same MSBuild Arguments to build this solution/project:

"<PathForMSBuild.exeOnYourAgent>\MSBuild.exe" "<YourProject/SolutionPath>" /p:SkipInvalidConfigurations=true /p:DeployOnBuild=true /p:WebPublishMethod=FileSystem /p:publishUrl="$(build.artifactstagingdirectory)\\" /p:DeployDefaultTarget=WebPublish

enter image description here

If you want to add additional files after the build, you could add a task after Visual Studio build task, or you can create AfterBuild Target in your project to add additional files.

Hope this helps.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.