Asp.net 使用aspnet生成VSTS“U合并导致错误”;元素';建筑供应商';无法在应用程序级别下定义“;

Asp.net 使用aspnet生成VSTS“U合并导致错误”;元素';建筑供应商';无法在应用程序级别下定义“;,asp.net,msbuild,azure-pipelines,Asp.net,Msbuild,Azure Pipelines,当我在VSTS中使用aspnetcompiler在msbuild参数或发布配置文件中生成asp.net应用程序时,会出现以下错误: MyProject\obj\release\aspnetcompilemerge\source\web.config(129,0): Error ASPCONFIG: The element 'buildProviders' cannot be defined below the application level. Process 'msbuild.exe' ex

当我在VSTS中使用aspnetcompiler在msbuild参数或发布配置文件中生成asp.net应用程序时,会出现以下错误:

MyProject\obj\release\aspnetcompilemerge\source\web.config(129,0): Error ASPCONFIG: The element 'buildProviders' cannot be defined below the application level.
Process 'msbuild.exe' exited with code '1'.
我相信这是指web.config的这一部分:

<buildProviders>
    <add extension=".rdlc" type="Microsoft.Reporting.RdlBuildProvider, Microsoft.ReportViewer.WebForms, Version=14.0.0.0, Culture=neutral, PublicKeyToken=89845DCD8080CC91" />
</buildProviders>

使用该设置,您也无法通过VS 2015发布它

将此代码添加到项目文件(xx.csproj):



我无法在MVC 4和Web表单项目(VS2015)中重现此问题。(将该buildProvider添加到system.web>编译部分)。你的项目是什么类型的?发布配置文件的详细代码是什么?你能用一个新项目重现这个问题吗?你能在这里分享详细的构建日志吗?@starain MSFT谢谢你的时间。我在问题中添加了更多信息。我创建了一个新项目来处理设置,它似乎与
csproj设置有关。谢谢。我可以发誓我的配置在本地工作,但显然不行。
<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>
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 for path (d:\a\1\s\buildprovidertest\obj\Release\Package\PackageTmp)
2017-07-31T13:43:32.4134567Z   Adding ACL's for 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   Successfully executed Web deployment task.
2017-07-31T13:43:32.4984583Z   Package "buildprovidertest.zip" is successfully created as single file at the following location:
2017-07-31T13:43:32.4984583Z   file:///d:/a/1/a
2017-07-31T13:43:32.4984583Z   To get the instructions on how to deploy the web package please visit the 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 for deploying this package is generated at the following location:
2017-07-31T13:43:32.5184584Z   d:\a\1\a\buildprovidertest.deploy.cmd
2017-07-31T13:43:32.5184584Z   For this sample script, you can change the deploy parameters by changing the 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: It is an error to use a section registered as allowDefinition='MachineToApplication' beyond application level.  This error can be caused by a virtual directory not being configured as an application in IIS.
2017-07-31T13:43:37.9922053Z d:\a\1\s\buildprovidertest\obj\release\aspnetcompilemerge\source\web.config(21): error ASPCONFIG: It is an error to use a section registered as allowDefinition='MachineToApplication' beyond application level.  This error can be caused by a virtual directory not being configured as an 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: It is an error to use a section registered as allowDefinition='MachineToApplication' beyond application level.  This error can be caused by a virtual directory not being configured as an 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 with code '1'.
2017-07-31T13:43:38.1882046Z ##[section]Finishing: Build solution
<Target Name="MvcBuildViews" AfterTargets="AfterBuild" Condition="'$(MvcBuildViews)'=='true'">
    <AspNetCompiler VirtualPath="temp" PhysicalPath="$(WebProjectOutputDir)" />
  </Target>
  <Target Name="AfterBuild">
    <RemoveDir Directories="$(BaseIntermediateOutputPath)" />
  </Target>