Asp.net web api 由于Microsoft.DiaSymReader.Native程序集,使用msbuild生成的Web Api无法工作

Asp.net web api 由于Microsoft.DiaSymReader.Native程序集,使用msbuild生成的Web Api无法工作,asp.net-web-api,msbuild,command-line-interface,roslyn,Asp.net Web Api,Msbuild,Command Line Interface,Roslyn,我最近在VST上使用MSBuild构建web api项目时遇到了一个问题,我设法在本地复制了它 我的Web Api是一个标准的普通Api,没有添加任何花哨的东西。 它安装了以下软件包: <packages> <package id="Autofac" version="4.5.0" targetFramework="net461" /> <package id="Autofac.Owin" version="4.0.0" targetFramework="n

我最近在VST上使用MSBuild构建web api项目时遇到了一个问题,我设法在本地复制了它

我的Web Api是一个标准的普通Api,没有添加任何花哨的东西。 它安装了以下软件包:

<packages>
  <package id="Autofac" version="4.5.0" targetFramework="net461" />
  <package id="Autofac.Owin" version="4.0.0" targetFramework="net461" />
  <package id="Autofac.WebApi2" version="4.0.1" targetFramework="net461" />
  <package id="Autofac.WebApi2.Owin" version="4.0.0" targetFramework="net461" />
  <package id="AutoMapper" version="6.0.2" targetFramework="net461" />
  <package id="CommonServiceLocator" version="1.3" targetFramework="net461" />
  <package id="EntityFramework" version="6.1.3" targetFramework="net461" />
  <package id="Kentico.Libraries" version="10.0.16" targetFramework="net461" />
  <package id="Kentico.Libraries.Dependencies" version="10.0.16" targetFramework="net461" />
  <package id="log4net" version="2.0.8" targetFramework="net461" />
  <package id="Microsoft.AspNet.Cors" version="5.2.3" targetFramework="net461" />
  <package id="Microsoft.AspNet.WebApi" version="5.2.3" targetFramework="net461" />
  <package id="Microsoft.AspNet.WebApi.Client" version="5.2.3" targetFramework="net461" />
  <package id="Microsoft.AspNet.WebApi.Core" version="5.2.3" targetFramework="net461" />
  <package id="Microsoft.AspNet.WebApi.Owin" version="5.2.3" targetFramework="net461" />
  <package id="Microsoft.AspNet.WebApi.Tracing" version="5.2.3" targetFramework="net461" />
  <package id="Microsoft.AspNet.WebApi.WebHost" version="5.2.3" targetFramework="net461" />
  <package id="Microsoft.CodeDom.Providers.DotNetCompilerPlatform" version="1.0.3" targetFramework="net461" />
  <package id="Microsoft.Net.Compilers" version="2.0.1" targetFramework="net461" developmentDependency="true" />
  <package id="Microsoft.Owin" version="3.1.0" targetFramework="net461" />
  <package id="Microsoft.Owin.Cors" version="3.1.0" targetFramework="net461" />
  <package id="Microsoft.Owin.Host.SystemWeb" version="3.1.0" targetFramework="net461" />
  <package id="Newtonsoft.Json" version="10.0.2" targetFramework="net461" />
  <package id="Owin" version="1.0" targetFramework="net461" />
  <package id="PagedList" version="1.17.0.0" targetFramework="net461" />
  <package id="System.Linq.Dynamic" version="1.0.7" targetFramework="net461" />
</packages>
并将我的IIS指向_PublishedWebsites\Portal.WebApi\文件夹,它将失败,并出现以下错误:

无法加载文件或程序集 “Microsoft.DiaSymReader.Native.amd64.dll”或其依赖项之一。 模块应包含程序集清单

如果我从API项目中删除Microsoft.CodeDom.Providers.DotNetCompilerPlatform和Microsoft.Net.Compilers包,并使用MSBuild重新生成它,则API将按预期再次工作

如果比较bin文件夹(Visual studio build与MSBuild),则MSBuild bin文件夹具有其他DLL,并且roslyn文件夹的所有内容都直接添加到bin文件夹中


有人遇到过这样的问题吗?

bin中的roslyn文件夹是Microsoft.CodeDom.Providers.DotNetCompilerPlatform的工作方式。CodeDom需要能够在运行时编译.cshtml视图,因此需要额外的文件夹
msbuild Portal.WebApi.csproj /p:Platform="Any CPU" /p:Configuration="Nightly" /p:VisualStudioVersion="14.0" /p:OutputPath="C:\Temp\BuildOutput"