【问题标题】:MSBuild failing due to sgen.exe errorMSBuild 由于 sgen.exe 错误而失败
【发布时间】:2018-05-20 16:21:51
【问题描述】:

我不知道从哪里开始。 我的构建在 Release 模式下失败。错误信息是:

SGEN:错误:来自程序集“Api,Version=1.0.0.0,Culture=neutral,PublicKeyToken=null”的“Api.Attributes.ModuleAuthorizeAttribute”类型中的方法“ExecuteAuthorizationFilterAsync”没有实现。

它显然有一个实现,它一直构建到 sgen 任务。 (并且在 Debug 模式下它完全构建,因为没有 sgen。)

虽然我可以更改像 here 这样的构建选项,但我宁愿找到问题的根源,而不是禁用优化。

还尝试制作一个小应用程序来重现问题但失败了,并且无法上传此应用程序。它很大,不是我要分享的。

【问题讨论】:

    标签: c# msbuild sgen


    【解决方案1】:

    我能够修复它。但这对我来说没有意义。

    更改.csproj 中的以下 lin 有帮助。

    <Reference Include="System.Net.Http, Version=4.1.1.2, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
      <HintPath>..\packages\System.Net.Http.4.3.3\lib\net46\System.Net.Http.dll</HintPath>
    </Reference>
    

    <Reference Include="System.Net.Http"/>
    

    工作。显然不满意。希望有人会提出解决方案/解释,但张贴以防万一。

    【讨论】:

      【解决方案2】:

      我在 csproj 中为发布模式添加了以下内容作为解决方法。

      <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
                      :
          <GenerateSerializationAssemblies>Off</GenerateSerializationAssemblies>
                      :
      </PropertyGroup>
      

      将引用标记更改为 &lt;Reference Include="dll name"/&gt; 对我不起作用。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 2013-10-26
        • 1970-01-01
        • 2016-03-06
        • 2011-05-09
        • 2017-05-05
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多