asp.net - VSTS build with aspnet_merge causes error "The element 'buildProviders' cannot be defined below the application level" -


when build asp.net application in vsts aspnetcompilemerge either in msbuild argument or publish profile, following error:

myproject\obj\release\aspnetcompilemerge\source\web.config(129,0): error aspconfig: element 'buildproviders' cannot defined below application level. process 'msbuild.exe' exited code '1'. 

i believe in reference section of web.config:

<buildproviders>     <add extension=".rdlc" type="microsoft.reporting.rdlbuildprovider, microsoft.reportviewer.webforms, version=14.0.0.0, culture=neutral, publickeytoken=89845dcd8080cc91" /> </buildproviders> 

but 2 things odd -

1) internet research on error message shows issues deploying or running website, i'm not deploying, building.

2) build seem succeed. i'm able download artifact , deploy on prem web server, , output appears have been merged defined in publish profile.

any ideas how resolve this?

edit - able reproduce situation in new mvc project.

publish profile:

<project toolsversion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">   <propertygroup>     <webpublishmethod>filesystem</webpublishmethod>     <lastusedbuildconfiguration>release</lastusedbuildconfiguration>     <lastusedplatform>any cpu</lastusedplatform>     <siteurltolaunchafterpublish />     <launchsiteafterpublish>true</launchsiteafterpublish>     <precompilebeforepublish>true</precompilebeforepublish>     <enableupdateable>false</enableupdateable>     <debugsymbols>false</debugsymbols>     <wdpmergeoption>mergealloutputstoasingleassembly</wdpmergeoption>     <usemerge>true</usemerge>     <singleassemblyname>buildprovidertest.publishedoutput</singleassemblyname>     <deleteappcodecompiledfiles>true</deleteappcodecompiledfiles>     <excludeapp_data>false</excludeapp_data>     <publishurl>c:\publish\buildprovidertest</publishurl>     <deleteexistingfiles>true</deleteexistingfiles>   </propertygroup> </project> 

i able narrow down <mvcbuildviews> node in csproj file. when true, error message. if set false, build succeeds.

posting entire build log exceeds character limit stackoverflow, here's end:

2017-07-31t13:43:32.4134567z   adding file (d:\a\1\s\buildprovidertest\obj\release\package\packagetmp\web.config). 2017-07-31t13:43:32.4134567z   adding acl's path (d:\a\1\s\buildprovidertest\obj\release\package\packagetmp) 2017-07-31t13:43:32.4134567z   adding acl's path (d:\a\1\s\buildprovidertest\obj\release\package\packagetmp) 2017-07-31t13:43:32.4204577z   adding declared parameter 'iis web application name'. 2017-07-31t13:43:32.4224576z   adding declared parameter 'defaultconnection-web.config connection string'. 2017-07-31t13:43:32.4904577z   executed web deployment task. 2017-07-31t13:43:32.4984583z   package "buildprovidertest.zip" created single file @ following location: 2017-07-31t13:43:32.4984583z   file:///d:/a/1/a 2017-07-31t13:43:32.4984583z   instructions on how deploy web package please visit following link: 2017-07-31t13:43:32.4984583z   http://go.microsoft.com/fwlink/?linkid=124618 2017-07-31t13:43:32.5184584z generatesampledeployscript: 2017-07-31t13:43:32.5184584z   sample script deploying package generated @ following location: 2017-07-31t13:43:32.5184584z   d:\a\1\a\buildprovidertest.deploy.cmd 2017-07-31t13:43:32.5184584z   sample script, can change deploy parameters changing following file:  2017-07-31t13:43:32.5184584z   d:\a\1\a\buildprovidertest.setparameters.xml 2017-07-31t13:43:32.5184584z pipelinedeployphase: 2017-07-31t13:43:32.5184584z   publish pipeline deploy phase 2017-07-31t13:43:32.6134809z cleanupforbuildmvcviews: 2017-07-31t13:43:32.6134809z   deleting file "obj\release\transformwebconfig\assist\web.config". snip 2017-07-31t13:43:32.6384579z   deleting file "obj\release\package\packagetmp\views\shared\_loginpartial.cshtml". 2017-07-31t13:43:32.6384579z mvcbuildviews: 2017-07-31t13:43:32.6384579z   c:\windows\microsoft.net\framework\v4.0.30319\aspnet_compiler.exe -v temp -p d:\a\1\s\buildprovidertest  2017-07-31t13:43:37.9922053z ##[error]buildprovidertest\obj\release\aspnetcompilemerge\source\web.config(21,0): error aspconfig: error use section registered allowdefinition='machinetoapplication' beyond application level.  error can caused virtual directory not being configured application in iis. 2017-07-31t13:43:37.9922053z d:\a\1\s\buildprovidertest\obj\release\aspnetcompilemerge\source\web.config(21): error aspconfig: error use section registered allowdefinition='machinetoapplication' beyond application level.  error can caused virtual directory not being configured application in iis. [d:\a\1\s\buildprovidertest\buildprovidertest.csproj] 2017-07-31t13:43:37.9922053z done building project "d:\a\1\s\buildprovidertest\buildprovidertest.csproj" (default targets) -- failed. 2017-07-31t13:43:37.9932061z done building project "d:\a\1\s\buildprovidertest.sln" (buildprovidertest target(s)) -- failed. 2017-07-31t13:43:37.9932061z  2017-07-31t13:43:37.9932061z build failed. 2017-07-31t13:43:38.0012046z  2017-07-31t13:43:38.0012046z "d:\a\1\s\buildprovidertest.sln" (buildprovidertest target) (1) -> 2017-07-31t13:43:38.0012046z "d:\a\1\s\buildprovidertest\buildprovidertest.csproj" (default target) (2) -> 2017-07-31t13:43:38.0012046z (mvcbuildviews target) ->  2017-07-31t13:43:38.0012046z   d:\a\1\s\buildprovidertest\obj\release\aspnetcompilemerge\source\web.config(21): error aspconfig: error use section registered allowdefinition='machinetoapplication' beyond application level.  error can caused virtual directory not being configured application in iis. [d:\a\1\s\buildprovidertest\buildprovidertest.csproj] 2017-07-31t13:43:38.0012046z  2017-07-31t13:43:38.0012046z     0 warning(s) 2017-07-31t13:43:38.0012046z     1 error(s) 2017-07-31t13:43:38.0012046z  2017-07-31t13:43:38.0012046z time elapsed 00:00:55.07 2017-07-31t13:43:38.1372049z ##[error]process 'msbuild.exe' exited code '1'. 2017-07-31t13:43:38.1882046z ##[section]finishing: build solution 

with setting, can’t publish through vs 2015 too.

add code project file (xx.csproj):

<target name="mvcbuildviews" aftertargets="afterbuild" condition="'$(mvcbuildviews)'=='true'">     <aspnetcompiler virtualpath="temp" physicalpath="$(webprojectoutputdir)" />   </target>   <target name="afterbuild">     <removedir directories="$(baseintermediateoutputpath)" />   </target> 

related thread: teamcity build failure


Comments

Popular posts from this blog

php - Vagrant up error - Uncaught Reflection Exception: Class DOMDocument does not exist -

vue.js - Create hooks for automated testing -

Add new key value to json node in java -