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.
-
Just checking in to see if the information provided was helpful. Please let us know if you would like further assistance.Leo Liu– Leo Liu2019-11-15 01:43:17 +00:00Commented Nov 15, 2019 at 1:43
-
1Hi 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=WebPublishZen Christophe– Zen Christophe2019-11-18 18:26:49 +00:00Commented Nov 18, 2019 at 18:26
-
Everything is perfect. I've just missed to validate your answer. Sorry for that.Zen Christophe– Zen Christophe2019-11-19 08:57:29 +00:00Commented Nov 19, 2019 at 8:57
1 Answer
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
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.
