Tsukasa
Tsukasa

Reputation: 23

ASP.NET Pipeline Not Publishing Content

I am attempting to create a new build pipeline in DevOps to build a website. The main solution is being used as the source; it contains the website project as well as a separate unit test project. The logs show the build is succeeding but the publish portion is not being run.

For the build solution step (using Visual Studio Build), I am passing in the following arguments:

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

I've run the same build arguments on my local machine using msbuild from C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\15.0\Bin which is putting content and respective files into the publishUrl parameter.

I've also tried using the default template without making any modifications. Default parameters are /p:DeployOnBuild=true /p:WebPublishMethod=Package /p:PackageAsSingleFile=true /p:SkipInvalidConfigurations=true /p:PackageLocation="$(build.artifactstagingdirectory)\\" but no package is being built in this scenario.

It feels like it's completely ignoring the publish options being passed in.

The $(build.artifactstagingdirectory) has been resolving to D:\a\1\a.

The publish artifact step yields the following log:

[warning]Directory 'D:\a\1\a' is empty. Nothing will be added to build artifact 'drop'. [section]Finishing: Publish Artifact: drop

Any one have some ideas or suggestions on what is going on? I'd like to know if/where I should be expecting the _PublishedWebsites folder to exist. I don't want to use a publish profile for this as I am not using Azure to do the actual deploy of the website.

Thanks!

msbuild output

2019-03-29T15:51:41.2933271Z ##[command]"C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\amd64\msbuild.exe" "D:\a\1\s\LoggingApi.sln" /nologo /nr:false /dl:CentralLogger,"D:\a\_tasks\VSBuild_71a9a2d3-a98a-4caa-96ab-affca411ecda\1.148.1\ps_modules\MSBuildHelpers\Microsoft.TeamFoundation.DistributedTask.MSBuild.Logger.dll";"RootDetailId=89dd4c73-fcb3-42df-9dc2-04dd3a648e8f|SolutionDir=D:\a\1\s"*ForwardingLogger,"D:\a\_tasks\VSBuild_71a9a2d3-a98a-4caa-96ab-affca411ecda\1.148.1\ps_modules\MSBuildHelpers\Microsoft.TeamFoundation.DistributedTask.MSBuild.Logger.dll" /p:SkipInvalidConfigurations=true /p:DeployOnBuild=true /p:WebPublishMethod=FileSystem /p:publishUrl="D:\a\1\a\\" /p:DeployDefaultTarget=WebPublish /p:DeleteExistingFiles=true /p:platform="any cpu" /p:configuration="release" /p:VisualStudioVersion="15.0" /p:_MSDeployUserAgent="VSTS_f901243b-a555-4171-87b9-2b1950d52707_build_3_0" 2019-03-29T15:51:41.3709460Z Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch. 2019-03-29T15:51:41.4083747Z Build started 3/29/2019 3:51:41 PM. 2019-03-29T15:51:41.5914885Z Project "D:\a\1\s\LoggingApi.sln" on node 1 (default targets). 2019-03-29T15:51:41.5931469Z ValidateSolutionConfiguration: 2019-03-29T15:51:41.5931540Z Building solution configuration "release|any cpu". 2019-03-29T15:51:41.9148684Z Project "D:\a\1\s\LoggingApi.sln" (1) is building "D:\a\1\s\LoggingApi\LoggingApi.csproj" (2) on node 1 (default targets). 2019-03-29T15:51:41.9148780Z PrepareForBuild: 2019-03-29T15:51:41.9148830Z Creating directory "bin\". 2019-03-29T15:51:47.5470138Z CoreCompile: 2019-03-29T15:51:47.5472670Z C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\Roslyn\csc.exe /noconfig /nowarn:1701,1702 /nostdlib+ /platform:AnyCPU /errorreport:prompt /warn:4 /define:TRACE /highentropyva+ /reference:D:\a\1\s\packages\Google.Protobuf.3.7.0\lib\net45\Google.Protobuf.dll /reference:D:\a\1\s\packages\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.2.0.1\lib\net45\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.dll /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.7.2\Microsoft.CSharp.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.7.2\mscorlib.dll" /reference:D:\a\1\s\packages\MySql.Data.8.0.15\lib\net452\MySql.Data.dll /reference:D:\a\1\s\packages\Newtonsoft.Json.12.0.1\lib\net45\Newtonsoft.Json.dll /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.7.2\System.ComponentModel.DataAnnotations.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.7.2\Facades\System.ComponentModel.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.7.2\System.Configuration.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.7.2\System.Configuration.Install.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.7.2\System.Core.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.7.2\System.Data.DataSetExtensions.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.7.2\System.Data.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.7.2\System.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.7.2\System.Drawing.Design.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.7.2\System.Drawing.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.7.2\System.Management.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.7.2\System.Net.Http.dll" /reference:D:\a\1\s\packages\Microsoft.AspNet.WebApi.Client.5.2.7\lib\net45\System.Net.Http.Formatting.dll /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.7.2\System.ServiceModel.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.7.2\System.Transactions.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.7.2\System.Web.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.7.2\System.Web.Extensions.dll" /reference:D:\a\1\s\packages\Microsoft.AspNet.WebApi.Core.5.2.7\lib\net45\System.Web.Http.dll /reference:D:\a\1\s\packages\Microsoft.AspNet.WebApi.WebHost.5.2.7\lib\net45\System.Web.Http.WebHost.dll /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.7.2\System.Xml.dll" /debug- /optimize+ /out:obj\Release\LoggingApi.dll /ruleset:"C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Team Tools\Static Analysis Tools\\Rule Sets\MinimumRecommendedRules.ruleset" /subsystemversion:6.00 /target:library /utf8output App_Start\WebApiConfig.cs App_Start\WebApiExceptionFilter.cs App_Start\WebApiNullCheckActionFilter.cs Authorization\WebApiAuthorization.cs Common.cs Constants.cs Controllers\BaseController.cs Controllers\MessageController.cs Dal.cs Global.asax.cs Controllers\EventsController.cs Models\LogEntryDto.cs Models\MessageDto.cs Properties\AssemblyInfo.cs "C:\Users\VssAdministrator\AppData\Local\Temp\.NETFramework,Version=v4.7.2.AssemblyAttributes.cs" 2019-03-29T15:51:47.6084430Z Using shared compilation with compiler from directory: C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\Roslyn 2019-03-29T15:52:08.9411825Z _CopyFilesMarkedCopyLocal: 2019-03-29T15:52:08.9412789Z Copying file from "D:\a\1\s\packages\MySql.Data.8.0.15\lib\net452\MySql.Data.dll" to "bin\MySql.Data.dll". 2019-03-29T15:52:08.9413051Z Copying file from "D:\a\1\s\packages\Google.Protobuf.3.7.0\lib\net45\Google.Protobuf.dll" to "bin\Google.Protobuf.dll". 2019-03-29T15:52:08.9413271Z Copying file from "D:\a\1\s\packages\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.2.0.1\lib\net45\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.dll" to "bin\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.dll". 2019-03-29T15:52:08.9415018Z Copying file from "D:\a\1\s\packages\Newtonsoft.Json.12.0.1\lib\net45\Newtonsoft.Json.dll" to "bin\Newtonsoft.Json.dll". 2019-03-29T15:52:08.9442165Z Copying file from "D:\a\1\s\packages\Microsoft.AspNet.WebApi.Client.5.2.7\lib\net45\System.Net.Http.Formatting.dll" to "bin\System.Net.Http.Formatting.dll". 2019-03-29T15:52:08.9442252Z Copying file from "D:\a\1\s\packages\Microsoft.AspNet.WebApi.Core.5.2.7\lib\net45\System.Web.Http.dll" to "bin\System.Web.Http.dll". 2019-03-29T15:52:08.9442305Z Copying file from "D:\a\1\s\packages\Microsoft.AspNet.WebApi.WebHost.5.2.7\lib\net45\System.Web.Http.WebHost.dll" to "bin\System.Web.Http.WebHost.dll". 2019-03-29T15:52:08.9460232Z Creating "D:\a\1\s\LoggingApi\obj\Release\LoggingApi.csproj.CopyComplete" because "AlwaysCreate" was specified. 2019-03-29T15:52:08.9479340Z CopyFilesToOutputDirectory: 2019-03-29T15:52:08.9479432Z Copying file from "obj\Release\LoggingApi.dll" to "bin\LoggingApi.dll". 2019-03-29T15:52:08.9484851Z LoggingApi -> D:\a\1\s\LoggingApi\bin\LoggingApi.dll 2019-03-29T15:52:09.1237828Z CopyRoslynCompilerFilesToOutputDirectory:

[roslyn stuff here]

2019-03-29T15:52:09.1587962Z Done Building Project "D:\a\1\s\LoggingApi\LoggingApi.csproj" (default targets).

Upvotes: 0

Views: 1735

Answers (1)

Leo Liu
Leo Liu

Reputation: 76670

ASP.NET Pipeline Not Publishing Content

Since the project type is web site and you do not want to use a publish profile, you can try following method:

After creating a publish profile in VS the following are created:

1) A publish profile (.pubxml file) under App_Data/PublishProfiles

2) A website.publishproj in the root of the website

The purpose of the website.publishproj is to facilitate command line publishing. Then you can try to use msbuild build task like the following to publish it:

msbuild.exe "WebSite1\website.publishproj" /p:DeployOnBuild=true /p:WebPublishMethod=Package /p:PackageAsSingleFile=true /p:SkipInvalidConfigurations=true /p:PackageLocation="$(build.artifactstagingdirectory)\\"

And this also should be work for the first command:

msbuild.exe "WebSite1\website.publishproj" /p:SkipInvalidConfigurations=true /p:DeployOnBuild=true /p:WebPublishMethod=FileSystem /p:publishUrl="$(build.artifactstagingdirectory)\\" /p:DeployDefaultTarget=WebPublish /p:DeleteExistingFiles=true

Hope this helps.

Upvotes: 1

Related Questions