No package generated in VSTS build (for ASP.net pr

2019-08-25 03:36发布

问题:

I'm using Microsoft team foundation server 2018's build task to build the Asp.net project and then deploy it to Microsoft Azure Website.

The following MsBuild command should publish the website to a publishing package in the build agent's artifact directory:

"C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\msbuild.exe" 
"C:\agent\_work\8\s\Altoro.sln" /nologo /nr:false /dl:CentralLogger,"C:\agent\_work\_tasks\VSBuild_71a9a2d3-a98a-4caa-96ab-affca411ecda\1.119.0\ps_modules\MSBuildHelpers\Microsoft.TeamFoundation.DistributedTask.MSBuild.Logger.dll";"RootDetailId=9ac05cfe-e8e9-42b6-a469-24e84f79ebe9|SolutionDir=C:\agent\_work\8\s"*ForwardingLogger,"C:\agent\_work\_tasks\VSBuild_71a9a2d3-a98a-4caa-96ab-affca411ecda\1.119.0\ps_modules\MSBuildHelpers\Microsoft.TeamFoundation.DistributedTask.MSBuild.Logger.dll" 
/p:DeployOnBuild=true /p:WebPublishMethod=Package /p:PackageAsSingleFile=true 
/p:SkipInvalidConfigurations=true /p:PackageLocation="C:\agent\_work\8\a\\" 
/p:platform="any cpu" /p:configuration="release" /p:VisualStudioVersion="15.0" 
/p:_MSDeployUserAgent="TFS_2386aba1-5b25-4025-ba06-4677ece9a429_build_8_125"

The build succeeded, however, there is no package generated, so the next release job failed with

'2017-12-02T07:36:56.2618898Z ##[warning]Folder “C:\agent_work\8\a”is empty。no content will be added to drop folder。

回答1:

To build ASP.NET website project, you should build *.publishproj instead of *.sln in Visual Studio build task

In your build definition -> unlink **\*.sln for Visual Studio build task -> specify the path to *.publishproj file -> save and build again.