Folks,
I'm using the Visual Studio Build task in TFS 2018 to build multiple .NET Core 2.0 web applications.
The solution parameter is: **\WebApp.*.sln
Where each solution is something like WebApp.Prj1.sln, WebApp.Prj2.sln, etc.
The MSBuild arguments are: /p:DeployOnBuild=true /p:WebPublishMethod=Package /p:PackageAsSingleFile=false /p:SkipInvalidConfigurations=true /p:DesktopBuildPackageLocation="$(build.artifactstagingdirectory)\WebApp.zip"
What I would like is to create the webapp.zip file specific to the solution I'm building. In other words, something like: /p:DesktopBuildPackageLocation="$(build.artifactstagingdirectory)\$(build.projectname).zip"
I don't seem to be able to find a built-in variable that allows me to access the solution or project name getting built.
Is this possible? If not, can someone post the equivalent powershell script that emulates the Visual Studio Build task so I can manually create the zipfile with the project name?
Thanks.
This is not supported by default and there is no built-in variable either.
If you want to customize the PowerShell script of Visual Studio build task. You could find the VSBuild.ps1
script under the build agent working directory _work/vstsbuildxxtask folder on your build agent machine.
Take a look at this thread: Visual Studio Build step should allow multiple paths
Another way is using multiple Visual Studio Build tasks combined with Copy and Publish Build Artifacts to handle multiple $(build.artifactstagingdirectory)\$(build.projectname).zip
packages per project.
Update:
There already been a related uservoice entry here: Using Variable in Solution Path in a Visual Studio Build Task
For your request, as a workaround, you could apply the whole solution path as a build variable and change it at build time. That means define a variable and set the value "$/repository/Development/Prj1/website name.sln". If you want build Prj2, change the Prj1 to Prj2 when queuing the build.
この記事はインターネットから収集されたものであり、転載の際にはソースを示してください。
侵害の場合は、連絡してください[email protected]
コメントを追加